How do I get the most linear part of a curve?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Looking for some ideas for solving to get the slope of the most linear part of a non linear curve.
4 comentarios
Image Analyst
el 10 de En. de 2018
Over what range? Of course every point of the curve is linear since every point on the curve has a tangent line. So at the very least it can be considered linear at every infinitesimally thin point. And the slope of that line is simply the derivative of your curve/equation. But are you looking for the most linear section over a distance of 2 or 4 or whatever in x?
Respuestas (2)
Birdman
el 10 de En. de 2018
One approach might be taking derivative of your numerical array by diff command, then find the minimum value in that vector and using the index, find the corresponding value in your main array. It should go like:
y=diff(x);
[val,idx]=min(y);
minSlope=x(idx+1)
2 comentarios
Russell Marki
el 7 de Sept. de 2019
I've done something that kind of works.
n is the length of the window as a fraction of the length of input x and y vectors.
An increase to length_weight will increase the value of a longer window.
0 comentarios
Ver también
Categorías
Más información sobre Least Squares 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!