Interpolate non-monotonic test data
이전 댓글 표시
Hello all,
I want to interpolate at specific values the curve in the picture attached (say every 0.01 in the x axis). Any idea how? The test data consists of a huge number of data points, so I want to clean them a bit.
Thanks

채택된 답변
추가 답변 (1개)
Image Analyst
2015년 8월 7일
0 개 추천
Try interp1(). By the way, interpolation won't "clean" the data. Why do you think it will? It will just give you more points in between the noisy ones. Perhaps you meant "regress" instead of "interpolate"??? If you meant regress, see my attached demo on polyfit().
Please READ THIS and then attach your screenshot (which you forgot to attach), and original data file, and maybe some code to read in the data file.
댓글 수: 3
Walter Roberson
2015년 8월 17일
Maybe they want to do a spline smoothing? Or some kind of low-pass filtering?
Image Analyst
2015년 8월 17일
I most certainly don't know everything about splines but I thought you give it training points, and it fits polynomials (like cubics) between them so that the slopes match at the training points. So if the original data is used as training points for the splines, then that noisy/erratic data is still in there. Sure you can interpolate points in between the noisy points, as my attached demo shows:

So, between the noisy data points it's smooth but the noisy data points are still there in the data.
Now maybe there's a different kind of spline that I need to learn about. That's quite possible as I know there are many flavors of splines and I'm just familiar with cubic splines.
For smoothing 1-D signals, I often use a Savitzky-Golay filter like I just did in this Answer: http://www.mathworks.com/matlabcentral/answers/234003-how-to-plot-a-histogram-with-distribution-fitting#answer_189490

Walter Roberson
2015년 8월 17일
카테고리
도움말 센터 및 File Exchange에서 Smoothing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!