Interpolate non monotonic and repetitive sperimental data
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Francesco Panico
el 13 de Mayo de 2018
Comentada: Francesco Panico
el 16 de Mayo de 2018
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 !
4 comentarios
Image Analyst
el 13 de Mayo de 2018
You can make your data monotonic by doing
[sortedx, sortorder] = sort(x, 'ascend');
sortedy = y(sortorder);
If you have a model for the function, you can use fitglm. See attached examples. If you just want to smooth, you can use sgolayfilt().
Attach your x and y data if you want more help. And be sure to read the link I gave you. If you had, I'd be working on your problem right now, but unfortunately you didn't and now I have to head out for dinner for a few hours.
Respuesta aceptada
John D'Errico
el 14 de Mayo de 2018
Editada: John D'Errico
el 14 de Mayo de 2018
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Smoothing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!