Interpolate non-monotonic test data
Ältere Kommentare anzeigen
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

Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 7 Aug. 2015
0 Stimmen
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 Kommentare
Walter Roberson
am 17 Aug. 2015
Maybe they want to do a spline smoothing? Or some kind of low-pass filtering?
Image Analyst
am 17 Aug. 2015
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
am 17 Aug. 2015
Kategorien
Mehr zu Smoothing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!