Interpolation of inaccurate datapoints

2 views (last 30 days)
snool on 28 Nov 2023
Edited: snool on 28 Nov 2023
I want to get an interpolation of my measured data. But my data is not 100% accurate and has measurement erros. I searched for interpolation functions of matlab and found things like griddedInterpolant. And all of them seem to always try to exactly match the given datapoints. But in my case it would be way better to get a smoother curve that only comes as close as possible to the datapoints.
The only other possibility I found is to define a function and use fminsearch e.g. like that:
fV = @(a,b,c,d,x) a.*exp(-(x.*b).^c)+d;
fDist = @(param) norm(fV(param(1), param(2), param(3), param(4), A) - V);
sol = fminsearch(fDist, [100, 0, 0.5, 0]);
But this means I need to know the behaviour of the data beforehand.
Sorry, I forgot to mention: I have a 2D problem with a few hundred data points. For example 250 voltages measured at 250 different distances. Here are some different examples:
Is there another possibility?

John D'Errico on 28 Nov 2023
Edited: John D'Errico on 28 Nov 2023
Interpolation does NOT allow the data to change. Essentially, that is what interpolation means. You need to do SMOOTHING, not interpolation, so approximation.
What form of approximation is best? That very much depends on the shape of the curve you need to approximate. And very much on what you know about the curve. It also depends on what kind of noise you have in the data. It sounds as if you want to approximate specific data points, and that suggests they are outliers, a completely different type of problem. Essentially, this makes it a large residual problem, and one where you have two separate sources of noise in your data, one of which creates large errors. In the end, this is something one could write a book about, and many have been written.
A simple low order poynomial model might be adequate. Or a nonlinear model. Or a smoothing spline. Or just a general smoothing tool (things like a median filter, or a Savitsky-Golay filter, etc.) If this is an outlier problem as I suspect, then there are outlier detection and replacement tools available.
Again, a book, even several books. And without knowing more about your data, it is difficult to be more specific. But interpolation is the one thing you don't want to do.