Wednesday, December 20, 2017

smoothing - how to smooth estimated velocity


I have a manipulator that provides the position and the velocity of its end-effector. The velocity is noisy. I've implemented a filter in C++ to determine the derivative of the position. In the below picture, the result of the filter in comparison with the velocity that the device generates is shown. enter image description here


The result is not that bad. If I zoom in more, there are spikes in the estimated velocity (i.e. the red curve).


enter image description here



These spikes cause troubles in my controller. I would like to smooth this data more. What is an efficient approach for this problem and easily to be implemented in C++ on online process? I've included the actual data time actualVelocity estimatedVelocity below


2.994 69.2363 70.7967
2.995 71.4746 68.9335
2.996 63.9789 67.7268
2.997 64.0197 68.6057
2.998 64.0499 68.9376
2.999 65.7443 69.9974
3 69.4333 70.2711
3.001 64.3986 67.7975
3.002 60.766 67.6402

3.003 63.541 67.8703
3.004 63.5812 68.9996
3.005 63.6111 69.3538
3.006 66.7847 70.4161
3.007 61.8865 67.2241
3.008 57.6895 66.992
3.009 57.7268 68.1139
3.01 57.7552 68.5353
3.011 63.9853 69.6728
3.012 60.5065 66.5398

3.013 56.1019 66.3731
3.014 56.1383 67.5572
3.015 56.1662 68.0364
3.016 56.1942 68.3706
3.017 52.5134 64.9745
3.018 49.3672 64.8698
3.019 55.5575 65.3146
3.02 55.583 65.8208
3.021 55.6029 63.6971
3.022 60.6736 63.8866

3.023 65.7919 65.3106
3.024 69.5424 65.983
3.025 62.819 63.0193
3.026 59.7945 63.9903
3.027 65.0101 64.6784
3.028 57.005 60.7158
3.029 57.0417 61.8959
3.03 51.2515 62.5295
3.031 51.2623 59.7834
3.032 57.0193 60.1369

3.033 61.3603 60.9797
3.034 58.779 59.2283
3.035 56.9265 59.7853
3.036 62.9212 61.5528
3.037 59.6156 59.0593
3.038 55.9486 59.5122
3.039 58.4439 59.3206
3.04 54.2936 57.5178
3.041 53.5189 58.1867
3.042 60.7797 60.0858

3.043 58.6784 57.7062
3.044 54.9992 58.2692
3.045 52.2677 55.7862
3.046 52.3881 57.3353
3.047 52.458 55.0719
3.048 52.6318 56.7019
3.049 60.2032 57.9943
3.05 60.213 55.6475
3.051 64.2043 56.3645
3.052 61.5772 54.9023

3.053 61.6064 55.8104
3.054 61.6064 52.4424
3.055 62.615 54.2973
3.056 63.3712 53.1572
3.057 63.405 54.234
3.058 63.4131 52.0953
3.059 60.4648 53.0826
3.06 65.9428 55.3929
3.061 62.2013 53.3822
3.062 49.7257 50.7939

3.063 49.7583 52.6719
3.064 49.7855 54.2839
3.065 40.7383 52.2356
3.066 42.5316 53.235
3.067 45.7656 52.0349
3.068 47.6251 53.1916
3.069 47.0313 51.1316
3.07 50.7313 54.2021
3.071 61.0434 55.9184
3.072 56.8516 53.7904

3.073 53.7284 54.6915
3.074 53.3688 53.3836
3.075 53.1414 54.4504
3.076 52.9485 53.191
3.077 52.8159 54.2778
3.078 58.6185 55.6848
3.079 57.2021 54.4031
3.08 56.0068 55.4162
3.081 55.089 54.0935
3.082 54.4169 55.1257

3.083 52.0654 52.9362
3.084 44.5892 51.2414
3.085 48.9719 53.2872
3.086 57.9513 54.9256
3.087 57.965 53.7357
3.088 57.9948 54.8184
3.089 54.6816 52.6628
3.09 54.2564 54.5502
3.091 53.9216 52.5363
3.092 45.9505 50.908

3.093 49.9106 52.9982
3.094 58.5814 54.6747
3.095 56.9995 53.5131
3.096 55.7105 54.6334
3.097 54.6014 53.3838
3.098 53.4868 54.4978
3.099 53.4933 52.3674
3.1 60.7252 54.3028
3.101 66.0402 55.6513
3.102 62.5392 54.6142

3.103 52.2202 51.8927
3.104 49.6543 52.8734
3.105 50.375 51.7245
3.106 51.251 52.9721
3.107 49.7411 50.9596
3.108 42.6241 49.4434
3.109 45.3093 50.7812
3.11 47.3085 49.816
3.111 47.334 51.2264
3.112 42.8512 50.2513

3.113 42.8538 48.0479
3.114 47.727 50.2688
3.115 49.3037 48.5915
3.116 48.561 49.9693
3.117 49.9082 49.0681
3.118 43.0426 46.9576
3.119 37.7041 45.6776
3.12 37.7286 47.3099
3.121 43.0863 50.2151
3.122 43.0887 48.6465

3.123 47.3152 47.3547
3.124 49.1506 48.8857
3.125 48.5832 47.1832
3.126 42.137 45.9618
3.127 47.2956 48.493
3.128 49.074 46.9782
3.129 40.5245 44.9057
3.13 43.6667 47.371
3.131 45.9253 45.9162
3.132 47.7511 48.4248

3.133 49.326 46.9107
3.134 40.9789 44.8425
3.135 44.583 47.3251
3.136 49.0912 46.7769
3.137 42.4347 44.8683
3.138 43.8255 46.4807
3.139 46.838 45.8501
3.14 40.9128 43.9865
3.141 34.5963 42.0455
3.142 40.152 44.7314

3.143 44.1766 43.4851
3.144 36.9593 41.6701
3.145 41.7885 44.4128
3.146 47.2533 44.0904
3.147 41.1964 42.3942
3.148 42.8078 44.2096
3.149 45.9244 43.7553
3.15 40.223 42.0586
3.151 36.0195 41.1673
3.152 40.9794 43.1975

3.153 42.7042 41.941
3.154 42.7103 41.1225
3.155 42.7164 40.4333
3.156 35.7873 38.9077
3.157 38.6424 40.9832
3.158 38.6486 40.7745
3.159 48.8273 42.9534
3.16 48.84 42.6373
3.161 48.3349 41.0337
3.162 37.5838 38.1872

3.163 37.5927 37.3523
3.164 37.615 40.5582
3.165 29.7713 39.6596
3.166 26.4404 38.1423
3.167 25.8594 37.5332
3.168 25.7574 36.2033
3.169 25.8087 35.7406
3.17 25.8283 38.2079
3.171 25.8276 37.1038
3.172 25.6308 35.7203

3.173 25.5471 35.2793
3.174 25.4776 34.1189
3.175 25.4314 33.8151
3.176 33.263 36.4421
3.177 36.702 35.7085
3.178 33.7323 35.3742
3.179 39.4528 37.898
3.18 43.4629 37.963
3.181 38.7537 36.7159
3.182 32.608 35.1005

3.183 28.0916 33.7598
3.184 27.279 33.4493
3.185 34.7325 36.1109
3.186 40.0501 36.3047
3.187 40.0553 37.2179
3.188 40.0572 36.1561
3.189 37.7629 35.7401
3.19 42.6337 38.2464
3.191 46.285 38.2866
3.192 40.5306 37.0151

3.193 36.3534 36.5108
3.194 33.2923 35.2624
3.195 31.0574 34.8723
3.196 31.4203 34.6467
3.197 39.4899 38.1665
3.198 43.3703 37.4697
3.199 43.3716 37.0304
3.2 42.4843 38.3303
3.201 44.1344 38.1623
3.202 41.2195 37.7719

3.203 38.6457 37.3635
3.204 36.4503 36.9779
3.205 36.4497 35.7195
3.206 42.9335 39.0159
3.207 48.0171 39.1301
3.208 48.0189 38.7185
3.209 43.855 38.247
3.21 38.7256 36.8946
3.211 43.2132 40.108
3.212 48.7904 40.1399

3.213 42.0778 38.5172
3.214 39.4119 38.995
3.215 37.462 37.5171
3.216 33.5367 36.9475
3.217 41.4155 40.2978
3.218 45.1633 39.4391
3.219 48.073 42.5853
3.22 48.0766 42.4501
3.221 48.0802 41.7886
3.222 52.2611 41.083

3.223 45.0587 39.5138
3.224 48.6285 42.552
3.225 52.9948 42.4014
3.226 47.3224 41.7404
3.227 43.2446 41.0317
3.228 38.267 39.4651
3.229 43.0282 42.5195
3.23 48.4121 42.3672
3.231 43.9171 41.7082
3.232 38.7986 40.1071

3.233 35.0193 39.3543
3.234 34.1795 38.7809
3.235 31.7445 37.3782
3.236 31.7387 36.8297
3.237 31.7329 36.4486
3.238 36.8617 38.9979
3.239 42.5141 38.9852
3.24 42.1992 39.6896
3.241 39.9799 38.438
3.242 35.8144 37.841

3.243 32.8308 36.4937
3.244 38.3231 39.7899
3.245 42.139 38.9544
3.246 37.7755 38.3927
3.247 38.5058 39.045
3.248 38.5038 37.8255
3.249 38.5001 37.2723
3.25 38.5836 36.8626
3.251 38.5807 35.6011
3.252 36.7759 35.1813

3.253 36.7727 34.0241
3.254 36.7658 33.7206
3.255 33.7419 32.6744
3.256 34.0696 33.6017
3.257 34.0621 33.6645
3.258 34.0546 33.5762
3.259 34.0715 32.5742
3.26 39.9283 36.1988
3.261 44.1935 35.6368
3.262 38.8896 35.3224

3.263 39.4722 36.2021
3.264 38.0505 35.1925
3.265 34.4752 34.8331
3.266 33.8126 34.6023
3.267 31.4175 33.5124
3.268 29.6603 33.2395
3.269 30.3045 33.1232
3.27 30.3006 32.1452
3.271 30.2928 31.983
3.272 30.7481 31.9576

3.273 29.1597 31.0678
3.274 30.4138 32.1092
3.275 30.8251 31.1444
3.276 31.1717 32.1687
3.277 40.2902 35.2798
3.278 44.357 35.5802
3.279 40.7408 35.4037
3.28 38.1993 35.1667
3.281 34.7164 34.034
3.282 32.1725 33.7212

3.283 32.1316 33.5618
3.284 30.1586 32.5428
3.285 30.6353 33.2308
3.286 30.9279 32.3771
3.287 30.9194 32.2079
3.288 30.9109 32.161
3.289 27.4029 31.2549
3.29 28.7391 32.0361
3.291 29.5937 31.2666
3.292 28.3039 31.181

3.293 29.2334 31.2124
3.294 27.9665 30.3725
3.295 27.1646 30.3319
3.296 28.5329 30.424
3.297 29.4332 30.5257
3.298 28.1585 29.7406
3.299 29.5844 30.8701
3.3 30.6576 30.2244
3.301 29.0064 30.2248
3.302 29.6929 30.3241

3.303 29.6883 29.5449
3.304 30.6179 29.56
3.305 30.6086 29.7036
3.306 30.6041 28.9771
3.307 31.2414 29.0365
3.308 33.6999 30.3354
3.309 35.5425 30.6331
3.31 34.4629 30.7551
3.311 31.7389 29.9525
3.312 29.512 29.9318

3.313 30.083 30.0461
3.314 30.9187 30.1689
3.315 31.2723 30.2854
3.316 29.4941 29.5115
3.317 28.2067 29.5232
3.318 29.1683 29.656
3.319 32.0831 30.9215
3.32 32.0732 31.1768
3.321 32.0685 30.3631
3.322 36.091 31.1904

3.323 34.8395 30.4753
3.324 32.0626 30.4296
3.325 31.9643 30.4959
3.326 31.8491 30.5763
3.327 34.1554 31.769
3.328 33.8997 31.0707
3.329 31.4239 30.9903
3.33 31.5502 31.0093
3.331 29.6005 30.1739
3.332 28.2382 30.1213

3.333 31.5653 31.3146
3.334 33.9333 31.5208
3.335 31.3705 30.6774
3.336 29.5183 30.5918
3.337 29.6373 30.635
3.338 29.6236 31.8054
3.339 27.7966 31.1012
3.34 26.8949 31.0116
3.341 28.1334 31.0214
3.342 29.5415 31.2863

3.343 30.5435 31.3366
3.344 30.7985 31.3488
3.345 30.907 31.3603
3.346 33.287 32.4672
3.347 33.2855 31.711
3.348 30.9188 31.5681
3.349 31.0431 31.528
3.35 31.123 31.5133
3.351 31.1132 31.4975
3.352 29.2816 30.6194

3.353 31.7528 32.4973
3.354 31.7478 31.8586
3.355 31.7379 31.7193
3.356 35.4215 31.6702
3.357 42.9547 35.6394
3.358 48.3931 36.013
3.359 41.8272 34.9075
3.36 39.3452 35.6026
3.361 39.4619 35.4448
3.362 37.1994 35.158

3.363 35.6164 34.8682
3.364 34.5392 34.5898
3.365 33.6621 34.3372
3.366 32.9767 34.0984
3.367 32.477 33.8769
3.368 30.2655 32.809
3.369 28.4052 32.5336
3.37 28.3878 34.3703
3.371 28.9757 34.4636
3.372 32.2261 35.3757

3.373 34.3072 35.255
3.374 31.5054 34.1168
3.375 29.6265 33.7412
3.376 30.0189 33.5136
3.377 30.8475 33.5638
3.378 31.3479 33.4168
3.379 31.2482 33.2469
3.38 29.3832 32.2208
3.381 27.9818 31.983
3.382 28.7749 31.8823

3.383 29.9162 32.0497
3.384 30.78 32.0171
3.385 28.9811 31.0909
3.386 28.9723 30.9342
3.387 28.9618 31.1522
3.388 27.4742 31.1782
3.389 27.9696 31.1712
3.39 27.9648 30.3025
3.391 30.9126 31.2947
3.392 30.9027 31.4379

3.393 30.8975 30.5705
3.394 31.452 29.5994
3.395 31.8467 30.6193
3.396 33.9053 30.8032
3.397 33.8947 30.8393
3.398 33.8886 29.9985
3.399 33.878 29.9182
3.4 33.8613 31.0569
3.401 31.1088 30.3758
3.402 31.0991 30.2978

3.403 31.0893 30.3167
3.404 31.0795 30.3566
3.405 27.3451 29.5405
3.406 26.4465 29.4868
3.407 29.8489 30.6507
3.408 32.4103 30.8561
3.409 31.8433 30.8861
3.41 29.5489 30.0287
3.411 28.1946 29.9376
3.412 29.044 29.977

3.413 27.6852 29.1848
3.414 29.0797 30.2411
3.415 31.9247 30.4421
3.416 29.677 29.647
3.417 27.8449 29.5837
3.418 28.7112 29.6437
3.419 28.7018 29.7263
3.42 28.6924 29.8011
3.421 20.9902 25.9766
3.422 15.105 25.6444

3.423 19.3495 25.9088
3.424 20.5645 25.4032
3.425 21.3979 25.6482
3.426 23.9181 26.0001
3.427 25.7664 26.3473
3.428 26.6897 26.6718
3.429 27.3415 26.9721
3.43 27.3315 27.4828
3.431 25.8452 26.6788
3.432 27.0944 27.8721

3.433 28.0074 27.1548
3.434 28.6786 28.3323
3.435 29.0908 27.5835
3.436 29.0758 28.7224
3.437 29.0652 29.0264
3.438 25.1852 28.3246
3.439 24.7808 28.3409
3.44 24.7721 28.4796
3.441 24.7633 28.6295
3.442 26.3398 28.7655

3.443 25.1244 27.8196
3.444 26.4862 28.9053
3.445 26.4862 27.2612
3.446 26.4497 23.0204
3.447 26.4401 22.7941
3.448 26.4305 23.2363
3.449 30.0122 23.7534
3.45 30.0075 23.4186
3.451 30.3645 23.7975
3.452 30.3648 24.2752

3.453 30.354 24.7327
3.454 30.3432 25.158
3.455 19.5337 20.5238
3.456 11.387 20.3844
3.457 16.4682 20.98
3.458 20.5531 21.6643
3.459 21.5333 21.482
3.46 22.1549 22.0015
3.461 24.3399 22.6027
3.462 16.7547 18.9772

3.463 9.47419 18.2617
3.464 13.2386 18.8909
3.465 17.7914 19.7059
3.466 10.3148 15.4536
3.467 4.6049 15.6832
3.468 11.5815 16.6289
3.469 17.0648 17.6317
3.47 20.5341 18.5806
3.471 21.2433 18.6231
3.472 21.9569 19.3531

3.473 14.9474 15.9219
3.474 9.90412 16.2495
3.475 15.3613 17.1692
3.476 17.5237 17.3021
3.477 17.5098 18.1175
3.478 19.378 18.999
3.479 12.8961 15.6021
3.48 7.89487 15.9492
3.481 12.0819 16.0594
3.482 15.1797 16.9493

3.483 19.2204 17.9102
3.484 19.8431 17.7638
3.485 11.0944 14.2583
3.486 11.0875 13.8408
3.487 11.0641 15.6034
3.488 5.3763 15.9661
3.489 5.33111 12.6443
3.49 10.4194 13.1836
3.491 13.4801 13.26
3.492 15.6255 14.3081

3.493 15.6204 14.6297
3.494 15.6085 15.6378
3.495 19.0612 16.6881
3.496 19.0497 17.679
3.497 19.0124 14.3328
3.498 21.5575 14.7492
3.499 23.7683 15.7589
3.5 21.3014 14.9307
3.501 21.2623 16.5389
3.502 23.495 16.8049

3.503 23.4598 13.3829
3.504 23.45 13.8405
3.505 20.944 13.8558
3.506 21.1613 14.8502
3.507 23.6943 15.9352
3.508 16.0547 12.689
3.509 8.28118 12.1668
3.51 11.8256 13.1737
3.511 16.6549 14.3664
3.512 10.7997 11.2176

3.513 4.65265 11.0435
3.514 9.47028 12.1715
3.515 12.6956 12.395
3.516 14.8339 13.5027
3.517 18.7494 14.6848
3.518 10.3646 10.6953
3.519 4.07502 11.2171
3.52 10.7807 12.4476
3.521 15.8423 13.7099
3.522 6.27385 8.74275

3.523 -0.846183 9.22821
3.524 7.31312 10.5656
3.525 11.5158 11.1574
3.526 14.6694 12.3969
3.527 9.32565 9.342
3.528 3.69836 9.28871
3.529 8.91277 10.5344
3.53 14.4524 11.9134
3.531 9.12814 8.89915
3.532 3.51611 8.88668

3.533 8.71653 10.1581
3.534 14.2435 11.5587
3.535 16.5916 12.092
3.536 18.2532 13.2504
3.537 18.2218 9.07015
3.538 18.2095 9.88375
3.539 18.2043 10.1875
3.54 23.4054 12.4554
3.541 23.4054 12.0404
3.542 17.6419 8.70047

3.543 11.1472 9.43494
3.544 11.1279 10.7873
3.545 14.2248 11.355
3.546 7.54525 8.20586
3.547 7.52779 8.99629
3.548 4.41513 10.3791
3.549 9.39163 10.9775
3.55 1.32068 6.81763
3.551 -2.80646 7.53077
3.552 4.133 8.19947

3.553 4.11697 9.6063
3.554 4.10095 11.0448
3.555 -2.19462 7.24447
3.556 -5.01679 7.98301
3.557 1.95484 8.38797
3.558 5.31162 8.94613
3.559 0.319966 5.91571
3.56 -1.63891 6.85716
3.561 6.65355 8.38671
3.562 10.9951 9.12827

3.563 11.9055 9.46156
3.564 3.06599 5.56191
3.565 -1.19867 6.37767
3.566 -1.21525 7.91064
3.567 -1.24861 4.29795
3.568 4.65486 4.21951
3.569 9.00043 5.74269
3.57 12.586 6.64978
3.571 5.67142 3.7831
3.572 2.56228 4.873

3.573 8.11363 5.76425
3.574 2.41265 2.94448
3.575 -3.91337 2.29935
3.576 0.998685 3.83854
3.577 6.69427 4.8619
3.578 1.75105 2.1142
3.579 0.281967 3.32234
3.58 -5.59206 -1.09375
3.581 -10.1899 0.0382389
3.582 0.390079 2.00954

3.583 0.355428 -1.19774
3.584 0.338276 0.137836
3.585 8.0142 2.12975
3.586 0.373597 -2.09604
3.587 0.356872 -0.869896
3.588 0.340146 1.16767
3.589 0.306535 -1.98837
3.59 -16.6841 -6.03154
3.591 -15.6592 -4.53399
3.592 -15.6806 -2.23394

3.593 -5.16985 -0.7103
3.594 -5.2027 -4.0775
3.595 -5.22049 -2.59917
3.596 -7.44088 -4.85935
3.597 -11.199 -4.92162
3.598 -4.29835 -2.85141
3.599 -5.197 -5.00553
3.6 -8.04643 -4.2727
3.601 -10.1369 -6.56157
3.602 -11.1013 -5.52588

3.603 -11.1228 -3.25123
3.604 -11.1603 -6.35483
3.605 -2.04365 -4.70267
3.606 6.27009 -2.37939
3.607 -1.26788 -6.2986
3.608 -6.85029 -4.78922
3.609 2.55966 -2.48377
3.61 -2.25953 -5.6496
3.611 -5.75823 -4.05831
3.612 -6.43697 -6.25225

3.613 -9.05772 -5.45368
3.614 -2.78693 -3.99083
3.615 -4.17667 -5.46656
3.616 -7.29433 -5.36271
3.617 -11.323 -7.72953
3.618 -10.4604 -5.88326
3.619 -2.22119 -4.46198
3.62 -2.26587 -6.6771
3.621 -2.27567 -5.86781
3.622 -6.99636 -8.85642

3.623 -7.01489 -7.04681
3.624 -8.17829 -4.5754
3.625 -10.2785 -7.61391
3.626 -13.5282 -6.64671
3.627 -3.9324 -4.33781
3.628 -7.1399 -7.42408
3.629 -9.4788 -5.73322
3.63 -8.81602 -7.85582
3.631 -10.0973 -6.73039
3.632 -10.135 -9.86513

3.633 -1.64492 -8.03469
3.634 4.65996 -6.25364
3.635 -2.68593 -9.31785
3.636 -2.70229 -7.51039
3.637 -2.71102 -5.76612
3.638 -2.75129 -7.90314
3.639 -6.45626 -6.03998
3.64 -6.46526 -4.61236
3.641 -6.49919 -7.62338
3.642 2.69985 -5.92031

3.643 -2.55867 -9.03712
3.644 -7.96961 -8.00563
3.645 -0.0749639 -5.62584
3.646 -2.53574 -7.68701
3.647 -6.3796 -6.80159
3.648 -11.3161 -9.77567
3.649 -12.8048 -7.94358
3.65 -3.54146 -6.1743
3.651 -6.55737 -8.31933
3.652 -10.8498 -8.14485

3.653 -13.8498 -10.4257
3.654 -13.8602 -9.17674
3.655 -13.8794 -6.70033
3.656 -23.083 -9.44035
3.657 -20.1565 -7.59754
3.658 -10.9859 -6.81851
3.659 -11.0269 -9.10326
3.66 -5.92705 -7.93827
3.661 -0.164666 -6.29067
3.662 -4.43565 -8.4734

3.663 -7.51559 -7.33776
3.664 -9.55375 -9.54427
3.665 -13.0669 -9.30264
3.666 -7.37936 -7.71959
3.667 -10.8035 -10.5599
3.668 -11.6553 -8.67552
3.669 -12.5859 -11.4128
3.67 -12.6046 -9.46417
3.671 -12.6158 -7.5927
3.672 -25.1555 -10.4129

3.673 -34.2201 -13.8202
3.674 -31.1251 -12.7804
3.675 -18.9966 -10.8545
3.676 -18.0085 -12.7421
3.677 -17.2536 -11.2957
3.678 -18.2518 -13.9645
3.679 -17.4329 -11.8503
3.68 -16.8929 -14.3753
3.681 -16.5205 -12.218
3.682 -16.5472 -15.6642

3.683 -6.37407 -14.294
3.684 -6.39188 -11.507
3.685 -6.42808 -13.9566
3.686 0.899313 -11.8197
3.687 0.874505 -15.3005
3.688 0.859468 -13.2471
3.689 -3.81297 -15.7129
3.69 -17.0914 -18.0544
3.691 -18.7707 -17.2986
3.692 -10.0336 -14.4287

3.693 -9.95477 -15.9877
3.694 -13.4828 -15.2346
3.695 -15.9165 -17.0942
3.696 -16.1297 -15.6085
3.697 -18.1549 -18.037
3.698 -19.5038 -16.5846
3.699 -18.9659 -18.2577
3.7 -16.638 -15.7359
3.701 -16.9755 -18.2206
3.702 -20.7505 -17.4777

3.703 -19.9003 -18.5109
3.704 -19.9003 -17.5131
3.705 -19.9449 -19.2145
3.706 -17.7008 -17.582
3.707 -17.8069 -19.1818
3.708 -17.9302 -17.5285
3.709 -19.464 -19.8402
3.71 -20.5583 -18.2615
3.711 -19.9418 -19.8399
3.712 -19.5126 -18.148

3.713 -19.2982 -19.7214
3.714 -20.5919 -18.7354
3.715 -21.7552 -20.3868
3.716 -20.994 -18.6787
3.717 -20.2462 -20.2223
3.718 -19.7761 -18.5069
3.719 -21.0871 -20.7657
3.72 -21.0982 -19.1264
3.721 -21.1438 -20.6719
3.722 -22.0126 -18.9285

3.723 -21.0774 -20.4695
3.724 -21.9093 -19.4311
3.725 -22.1681 -21.0617
3.726 -20.7368 -19.3139
3.727 -21.3232 -21.5292
3.728 -19.7558 -18.9338
3.729 -19.3918 -21.268
3.73 -30.8336 -24.0382
3.731 -30.8455 -22.2886
3.732 -30.8706 -18.9991

3.733 -40.6658 -21.909
3.734 -40.6925 -19.4092
3.735 -48.7079 -21.7416
3.736 -42.5385 -19.8449
3.737 -42.572 -22.2482
3.738 -42.6072 -24.9868
3.739 -42.6194 -23.1723
3.74 -42.6334 -20.5158
3.741 -37.6847 -22.7593
3.742 -44.1844 -25.446

3.743 -36.926 -22.6995
3.744 -33.4697 -25.4774
3.745 -32.977 -23.6511
3.746 -29.5297 -24.9441
3.747 -26.3531 -22.6824
3.748 -27.3204 -25.5468
3.749 -28.5807 -23.7301
3.75 -26.1096 -25.0323
3.751 -23.8229 -22.7666
3.752 -25.5193 -25.6313

3.753 -35.3322 -27.5894
3.754 -35.3428 -25.4963
3.755 -35.3774 -27.3289
3.756 -32.3421 -25.9059
3.757 -30.2204 -27.1541
3.758 -37.4154 -29.6536
3.759 -44.2055 -31.9792
3.76 -40.3681 -30.3435
3.761 -36.1069 -31.2901
3.762 -31.5328 -28.8053

3.763 -29.4992 -30.3844
3.764 -29.45 -28.7276
3.765 -29.4897 -29.7788
3.766 -31.1972 -32.7613
3.767 -29.2047 -29.6337
3.768 -29.0717 -31.9505
3.769 -28.8567 -28.7654
3.77 -25.8782 -30.2455
3.771 -25.6618 -27.9198
3.772 -25.8482 -29.5933

3.773 -37.3438 -32.7015
3.774 -33.7643 -29.6107
3.775 -29.5944 -31.0593
3.776 -28.4697 -28.6834
3.777 -27.5353 -30.3132
3.778 -26.8437 -28.0076
3.779 -26.3871 -29.6978
3.78 -36.3567 -32.1532
3.781 -33.4235 -29.6521
3.782 -33.4446 -32.0887

3.783 -19.1214 -28.9334
3.784 -19.1512 -30.6535
3.785 -18.2835 -32.8457
3.786 -20.9474 -31.1337
3.787 -20.9932 -31.4385
3.788 -23.7802 -33.3568
3.789 -36.0725 -36.2867
3.79 -35.1042 -33.8293
3.791 -31.2273 -34.5042
3.792 -40.0694 -37.1592

3.793 -36.194 -33.7452
3.794 -33.4102 -35.7878
3.795 -41.6268 -37.0854
3.796 -37.2414 -34.9605
3.797 -35.9189 -36.494
3.798 -42.0064 -37.6705
3.799 -37.5538 -35.489
3.8 -36.2566 -36.9926
3.801 -42.2019 -38.1454
3.802 -37.5354 -35.9301

3.803 -37.5683 -37.4004
3.804 -37.6136 -38.5284
3.805 -37.6136 -36.2849
3.806 -36.3193 -37.7346
3.807 -36.3601 -38.8507
3.808 -35.3926 -36.585
3.809 -34.6307 -38.0185
3.81 -42.4337 -39.7504
3.811 -48.3081 -41.6486
3.812 -44.1971 -39.3341

3.813 -40.4538 -40.5927
3.814 -46.0743 -42.1465
3.815 -50.6449 -43.8648
3.816 -50.6593 -40.5372
3.817 -54.6782 -41.5674
3.818 -46.9664 -38.2724
3.819 -41.4656 -39.4507
3.82 -41.4984 -41.0759
3.821 -41.5183 -43.5159
3.822 -37.9514 -40.5421

3.823 -33.3991 -40.8044
3.824 -41.6162 -43.0393
3.825 -41.6162 -40.6921
3.826 -41.6641 -41.0471
3.827 -49.7329 -42.6707
3.828 -45.3811 -40.2471
3.829 -43.3169 -42.0793
3.83 -43.3533 -43.047
3.831 -43.3679 -45.2619
3.832 -43.3897 -41.3224

3.833 -52.2654 -42.8524
3.834 -57.4693 -44.5601
3.835 -49.1798 -41.1995
3.836 -49.2348 -46.1706
3.837 -49.2503 -48.8475
3.838 -34.1132 -46.2065
3.839 -32.1 -46.2103
3.84 -30.6146 -43.2997
3.841 -29.5215 -43.4426
3.842 -39.1638 -45.5171

3.843 -49.0485 -47.7756
3.844 -42.8753 -43.6975
3.845 -39.1936 -45.0741
3.846 -47.9236 -46.6357
3.847 -41.3962 -43.1332
3.848 -37.617 -44.0344
3.849 -47.19 -46.2015
3.85 -51.9724 -47.0145
3.851 -55.425 -48.9794
3.852 -55.425 -46.214

3.853 -55.4746 -46.2348
3.854 -60.9937 -48.126
3.855 -64.0274 -49.5982
3.856 -54.2503 -45.9007
3.857 -46.8713 -46.6147
3.858 -51.9922 -47.7886
3.859 -55.8512 -49.1776
3.86 -49.8557 -46.3058
3.861 -44.9528 -46.921
3.862 -50.5194 -48.2736

3.863 -56.3158 -50.2661
3.864 -58.6885 -50.8324
3.865 -60.3881 -52.5417
3.866 -53.1371 -48.9117
3.867 -46.9074 -49.2517
3.868 -53.8973 -51.0238
3.869 -53.9429 -51.5253
3.87 -53.9429 -48.361
3.871 -53.9617 -49.6179
3.872 -57.0498 -50.1304

3.873 -57.0701 -51.8815
3.874 -57.1189 -52.3382
3.875 -59.4392 -53.9411
3.876 -51.9111 -50.0103
3.877 -51.9414 -50.4589
3.878 -47.2321 -52.1852
3.879 -47.2733 -52.6376
3.88 -47.2908 -54.2273
3.881 -54.6567 -55.3163
3.882 -57.6976 -56.0597

3.883 -60.0996 -56.9017
3.884 -63.4895 -58.2925
3.885 -55.4757 -54.2672
3.886 -55.5068 -54.2494
3.887 -55.5358 -55.0939
3.888 -48.1755 -55.8178
3.889 -54.3942 -57.264
3.89 -59.6054 -57.9556
3.891 -51.7652 -53.8438
3.892 -45.3839 -53.8513

3.893 -52.4326 -55.3045
3.894 -56.2648 -55.56
3.895 -57.3917 -56.1775
3.896 -50.5138 -52.739
3.897 -44.3999 -52.3713
3.898 -50.0124 -53.863
3.899 -56.3171 -55.0031
3.9 -61.4033 -56.581
3.901 -62.8616 -56.7953
3.902 -62.8818 -58.1094

3.903 -62.9156 -58.9594
3.904 -64.9519 -60.2471
3.905 -66.3237 -60.202
3.906 -65.2614 -60.7048
3.907 -66.8219 -61.826
3.908 -56.6842 -57.3514
3.909 -49.1042 -57.3181
3.91 -52.9914 -57.2548
3.911 -56.8542 -58.5074
3.912 -62.5185 -59.9018

3.913 -63.7326 -59.9147
3.914 -64.4597 -61.0184
3.915 -65.0646 -60.92
3.916 -55.0875 -57.066
3.917 -49.0233 -56.9691
3.918 -54.2407 -57.6924
3.919 -54.256 -53.4259
3.92 -54.3085 -58.5816
3.921 -47.4811 -54.9816
3.922 -43.6833 -55.8135

3.923 -51.4882 -56.5719
3.924 -51.4986 -52.5834
3.925 -51.531 -52.7659
3.926 -51.5593 -53.8184
3.927 -51.5917 -54.7448
3.928 -56.3892 -56.342
3.929 -56.4046 -52.3094
3.93 -56.4507 -57.605
3.931 -49.7932 -54.2973
3.932 -44.0856 -54.4954

3.933 -51.7198 -55.9895
3.934 -45.4249 -51.4332
3.935 -51.405 -57.253
3.936 -51.4161 -54.0529
3.937 -51.4496 -54.2965
3.938 -68.1287 -55.2815
3.939 -68.3577 -56.1362
3.94 -68.1634 -57.1111
3.941 -57.1605 -52.9412
3.942 -50.997 -53.8402

3.943 -57.4681 -54.967
3.944 -60.3365 -55.8773
3.945 -62.5316 -56.8839
3.946 -53.3468 -52.7398
3.947 -47.671 -53.6557
3.948 -53.1801 -54.0913
3.949 -56.9378 -55.6748
3.95 -60.9245 -56.8165
3.951 -51.9313 -52.705
3.952 -47.1659 -53.6347

3.953 -52.6942 -54.0864
3.954 -52.7128 -55.6729
3.955 -54.6726 -56.6325
3.956 -58.4406 -57.6248
3.957 -52.1512 -54.1562
3.958 -46.933 -54.3937
3.959 -52.8111 -55.4156
3.96 -57.0295 -56.312
3.961 -59.7208 -57.3204
3.962 -64.1218 -58.8128

3.963 -56.5829 -54.639
3.964 -56.6115 -54.9327
3.965 -56.6435 -55.7534
3.966 -49.2743 -56.7973
3.967 -49.2918 -58.3284
3.968 -49.3052 -54.1977
3.969 -49.3402 -59.9946
3.97 -49.3506 -56.6433
3.971 -55.1224 -56.7747
3.972 -55.1532 -57.6482

3.973 -55.1532 -54.1587
3.974 -58.1829 -54.4305
3.975 -58.2036 -55.9911
3.976 -58.7004 -56.4603
3.977 -58.7236 -57.9316
3.978 -50.6595 -54.5217
3.979 -44.9799 -54.2795
3.98 -51.5474 -55.7785
3.981 -58.775 -57.4606
3.982 -50.7011 -52.9178

3.983 -44.816 -53.8016
3.984 -51.8811 -54.8212
3.985 -56.4461 -55.9878
3.986 -56.4652 -57.6151
3.987 -56.4993 -58.522
3.988 -56.5108 -54.4853
3.989 -72.7637 -60.3172
3.99 -73.1132 -56.7874
3.991 -61.9088 -57.1012
3.992 -64.4975 -57.8389

3.993 -66.7656 -59.2797
3.994 -69.9238 -60.7507
3.995 -59.12 -55.985
3.996 -51.054 -56.6519
3.997 -55.9705 -56.9967
3.998 -59.97 -58.4328
3.999 -65.6491 -59.9626
4 -66.9753 -60.2395

Answer



As a first step, try just a simple first order smoother on your already-smoothed (but still too spiky) data: $$ v_f[n] = (1-\alpha) v_f[n-1] + \alpha v[n] $$ where $v_f$ is the velocity with extra filtering, $v$ is your current filtered velocity, and $0 \lt \alpha \lt 1$, and usually close to 1.



If I do this in the R code below, then I get the green line in the plot below (overlaying your noisy and smoothed data).


enter image description here




R Code Below


alpha <- 0.9
num <- c(1-alpha)
den <- c(1, -alpha)
vfilt <- signal::filter(num, den, data2[,3], data2[1,3])
plot(data2[,2])
lines(data2[,3],co="red")

lines(vfilt,col="green", lwd=5)

No comments:

Post a Comment

digital communications - Understanding the Matched Filter

I have a question about matched filtering. Does the matched filter maximise the SNR at the moment of decision only? As far as I understand, ...