フィルターのクリア

Interp function error with my curve

1 回表示 (過去 30 日間)
Alex
Alex 2016 年 6 月 28 日
編集済み: John D'Errico 2016 年 6 月 28 日
Hi everyone, I would like to have the polynome of my curve:
this is the plot :
plot(x,y)
I m trying to use:
xq= 5:45
vq2 = interp1(x,y,xq);
but I receive an error: Error using griddedInterpolant The grid vectors are not strictly monotonic increasing.
Error in interp1>Interp1D (line 346) F = griddedInterpolant(Xext,V,method);
What is wrong with my vector xq?
Thank you

回答 (1 件)

John D'Errico
John D'Errico 2016 年 6 月 28 日
編集済み: John D'Errico 2016 年 6 月 28 日
There is no simple polynomial that interpolates that curve. It clearly has a singularity at zero. The last time I checked, polynomials have no singularities.
Next, interp1 gets upset because you have at least some points that have the same x value. If two points have the same x value, but more than one possible y value, how do you expect interp1 to return a result? Which of that y values should it return?
Another possibility is that you might not have replicates, but that your curve has noise in the x variable, so that the curve appears to be non-monotonic in x. Again, it leaves you with a function that is not single-valued in the form y=f(x). So again, interp1 will not function.
The solution is usually to average the y values if you have replicates, replacing the replicates with a single point at that mean value. interp1 will now be happy. If it is just noise that made the x values non-monotone, then you might do a variety of things.
No matter what you do of course, you still won't get anything that is polynomial-like from that curve.
And since you have not attached the data itself, I cannot even suggest a viable model for this. (I can think of a few.) Really though, it is you who needs to pose a model, since only you know where the data comes from and what it means.

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by