How to locating the linear segment of a curve data and calculate the slope and interception?
9 views (last 30 days)
Show older comments
Abdulaziz Abutunis on 4 Oct 2016
Dear Matlab experts,
I have a set of non-linear data that has a linear segment close to the lift end of the curve. I wonder how to use the gradient function or any other function to locate the best range of points that represents the linear segment and thin find the slop and the interception point of this linear segment. An example of one of the sets of data is given below as x and y arrays
y=[-0.2757, -0.3914, -0.4219, -0.3808, 0.3122, 0.1272, 0.08, 0.1745, 0.2545, 0.327, 0.3932, 0.4539, 0.5091, 0.559, 0.604,0.645];
Thanks all, Aziz
John D'Errico on 4 Oct 2016
It this data is typical of your data, its not gonna happen.
Which linear segment are you referring to? Even if we ignore the apparent jump discontinuity in the middle of the curve, I don't see any obviously linear segment. Ok, take any pair of points, and we can put a linear segment between them. Otherwise, the curve seems to have a nice, smooth roll-over, with a continuously changing slope.
Getting a computer to do what you can see with your eyes is sometimes difficult. Getting a computer to do magic will be a bit harder.
dpb on 5 Oct 2016
Well, cleaning up the dataset does help at least some...it's pretty flimsy test and probably not at all robust, but you might start with just simple differences as you surmised--
>> hold all
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!