MATLAB: Interpolate non monotonic and repetitive sperimental data

esperimental datainterpolationmonotonicscattered data

Hi, I have a matrix of experimental points like this
360,795727281504 361,650330617608 361,650330617608 362,642755698073 363,288968788277 364,054221131940 364,054221131940 364,054221131940 364,054221131940 364,054221131940 364,054221131940 365,288499105590 366,191936918042 366,676715118651 366,676715118651
0,588235294117647 0,584313725490196 0,584313725490196 0,580392156862745 0,584313725490196 0,584313725490196 0,584313725490196 0,584313725490196 0,588235294117647 0,588235294117647 0,588235294117647 0,596078431372549 0,592156862745098 0,588235294117647 0,588235294117647
X value –> 1st row | Y value –> 2nd row
I'd like to interpolate this points, note that sometime X or Y value could repeat.
Thanks !

Best Answer

This is not a question about interpolation. Why not?
What is interpolation? It involves finding a curve that passes EXACTLY through the data points.
You clearly don't want to do that. But you are trying to use tools for interpolation, thus spline, interp1, etc.
You want to do smoothing and approximation. Since you have no model for this process, at best, you need to use a tool for spline smoothing of some sort. Polynomial curve fitting is a really BAD idea here, because you would need a really high order polynomial for the fit.
A good tool for this purpose would be my SLM Toolbox. There are many options. But given this very small set of rather noisy data, I tried this:
spl = slmengine(x,y,'plot','on','reg','cross');
which seems to be as much as it is worth.
You can download it from the File Exchange.
Now that you have uploaded your data,
mdl = slmengine(x,y,'plot','on','knots',100,'maxvalue',1);
If I now look more carefully at just the first section that seems fairly linear, there are a couple of things I see.
First, the curve seems to have a periodic behavior, that the spline wanted to follow. You can either smooth that out, treating it as noise, or you can chase it as I allowed the spline to do here.
Next, I see that your data appears to be quantized. So rather than random noise, you have a process that takes on only discrete levels. I'm not sure this really matters too much in context though.