How do I get the most linear part of a curve?

조회 수: 22 (최근 30일)
Deepika Sundar
Deepika Sundar 2018년 1월 10일
답변: Russell Marki 2019년 9월 7일
Looking for some ideas for solving to get the slope of the most linear part of a non linear curve.
  댓글 수: 4
Image Analyst
Image Analyst 2018년 1월 10일
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?
Deepika Sundar
Deepika Sundar 2018년 1월 10일
The range that I have arbitarily set is for 10 millimetres of displacement (X axis). Since this range (10mm) shifts left or right according to my experimental Parameters, I would have to Isolate the nearly linear Portion and determine the slope for this Portion. I currently do this in Excel visually.

댓글을 달려면 로그인하십시오.

답변 (2개)

Birdman
Birdman 2018년 1월 10일
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
Deepika Sundar
Deepika Sundar 2018년 1월 10일
So this way I can check for repeating slopes in the range mentioned. Thanks a lot I shall try this.
Birdman
Birdman 2018년 1월 10일
Try and let me know the results.

댓글을 달려면 로그인하십시오.


Russell Marki
Russell Marki 2019년 9월 7일
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.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by