math - Calculating angular acceleration c# -


i have 2 points. each point has course (degrees), , speed (m/s).

these points come gps file, , there thousands of them.

i trying eliminate glitches file, bad data unbelievable. 1 way of doing work out angular acceleration of change in speed , course between 2 points , if on kind of threshold, can eliminate point set piece of bad data (a spike in gps.)

this worked fine when points 1 second apart, i'm dealing points less 1 second apart (typically .2 second) , more valid data getting flagged spurious. i'm wondering if i've done wrong?

here code i'm using:

  double radcourse2 = p1.course*math.pi/180;   double radcourse1 = p2.course*math.pi/180;   double vel1x = math.abs(p1.speed*math.cos(radcourse1));   double vel1y = p1.speed*math.sin(radcourse1);   double vel2x = math.abs(p2.speed*math.cos(radcourse2));   double vel2y = p2.speed*math.sin(radcourse2);   // secs -1, -.2   double secs = p1.creationtime.subtract(p2.creationtime).totalseconds;    double accx = (vel2x - vel1x)/secs;   double accy = (vel2y - vel1y)/secs;    // if p2.acceleration above 5.5, fast.   p2.acceleration = math.sqrt(accx*accx + accy*accy);    // adjusting deceleration vs acceleration   if (p1.speed > p2.speed)     p2.acceleration *= -1; 

sample data. 3 marked lines out of bounds @ moment based on code above.

speed   course 12.06999973 135.459997 12.27999973 138.9399969 12.63999972 141.7999968 12.53999972 142.9699968 12.50999972 146.1299967 12.79999971 149.9399966 12.91999971 154.9699965 <-- 12.95999971 157.0699965 13.11999971 163.3799963 <-- 13.2399997  167.6799963 13.13999971 172.3599961 13.14999971 178.019996 <-- 13.3799997  181.6499959 13.2799997  183.9299959 12.51999972 188.0699958 12.42999972 191.0599957 11.95999973 196.1499956 11.71999974 200.5499955 11.16999975 204.7399954 10.74999976 210.3599953 10.19999977 215.2699952 

you not calculating angular acceleration, rather acceleration. more accurately, estimating magnitude of it. initially, estimating d2s / dt2 using dt == 1 second. estimating same quantity using dt == 0.2 seconds.

you can see reason threshold being exceeded more if output intermediate values calculations both timesteps. i've done below:

 t       speed      course     estimated  estimated  estimated acc   estimated acc                               velx       vely       (dt == 0.2)     (dt == 1)  0.000   12.070     135.460    8.466      -8.603 0.200   12.280     138.940    8.066      -9.259     3.843 0.400   12.640     141.800    7.817      -9.933     3.593 0.600   12.540     142.970    7.552      -10.011    1.379 0.800   12.510     146.130    6.972      -10.387    3.457 1.000   12.800     149.940    6.412      -11.078    4.449            5.092 1.200   12.920     154.970    5.466      -11.707    5.675 1.400   12.960     157.070    5.049      -11.936    2.380 1.600   13.120     163.380    3.753      -12.572    7.221 1.800   13.240     167.680    2.825      -12.935    4.981 2.000   13.140     172.360    1.747      -13.023    5.409            2.169 2.200   13.150     178.020    0.454      -13.142    6.490 2.400   13.380     181.650    -0.385     -13.374    4.356 2.600   13.280     183.930    -0.910     -13.249    2.699 2.800   12.520     188.070    -1.758     -12.396    6.011 3.000   12.430     191.060    -2.385     -12.199    3.286            2.277 3.200   11.960     196.150    -3.327     -11.488    5.902 3.400   11.720     200.550    -4.114     -10.974    4.701 3.600   11.170     204.740    -4.675     -10.145    5.006 3.800   10.750     210.360    -5.433     -9.276     5.768 4.000   10.200     215.270    -5.890     -8.328     5.261            4.346 

this shows values highlighted exceeding arbitrary 5.5 threshold, in calculations longer timestep, intermediate values ignored. so, instance, in second between t==1.0 , t==2.0, there 2 values @ 0.2 second timestep exceed threshold. however, 1 second timestep, estimate below threshold timestep.

if noise on each measurement random , magnitude independent of measurement interval (dt), smaller dt, larger expected error in estimated acceleration, dividing smaller number, if decrease dt factor of fifth, you'd expect error 5 times larger. note - doesn't mean you'd expect absolute value of acceleration 5 times larger, measurement error on it.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -