Sub-sampling the minimum number of points to accurately reproduce a curve
19 ビュー (過去 30 日間)
古いコメントを表示
Hello,
Currently some students of mine are working on a bioinspired robot. We are using poistion data collected directly from a moving animal and putting those values onto servo motors. Recently, we have come across a bit of an over-sampling issue that is casuing some computational issues.
Anyway, when I collect data from an animal I can get kinematic movements of position versus time. For this question, let's assume 100 data points. (Sorry about the sideways orientation of the photos).
![5.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/260679/5.jpeg)
Together these 100 data points can be graphed as a continuous curve
![7.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/260680/7.jpeg)
Now my problem is that if I make our robot hit all 100 data points the movement is highly accurate, but causes the servo motors to be very jerky and a lot of computational power. So my hope is to downsample/ subsample the number of points I have, but still retain the shape of that curve. For example:
![6.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/260681/6.jpeg)
If I reduce the data down to two points I get an abysmal representation of the original curve. What about 3 points?
![3.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/260682/3.jpeg)
Still not great...
However, by the time I hit 9 points, we're doing pretty good.
![1.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/260683/1.jpeg)
Essentially, I'd like some advice on 1) what this form of downsampling/ subsampling is even called; and 2) any ideas on some MATLAB code that can help me maximize accuracy while limiting data.
![4.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/260684/4.jpeg)
Any advice is greatly appreciated.
0 件のコメント
回答 (2 件)
David Goodmanson
2020 年 1 月 8 日
編集済み: David Goodmanson
2020 年 1 月 8 日
Hi Michael, take a look at the interp1 function. There are several choices for the type of interpolation, and assuming a curve that looks like your example, not too wild, the spline option (cubic spline) is one of the most accurate.
0 件のコメント
Robert Daly
2021 年 8 月 16 日
I had the same question as Michael, here is the best solution I have found.
For additional information on the algorithm follow this link
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Directed Graphs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!