MATLAB: Finding where a slope becomes linear

curve fitting

I recently took a class teaching Matlab and I'm trying to use it at my internship to find where our plotted data, using a vector of x and y data values, starts to become linear. I am trying to use a polyfit and then find the slope using the maximum slope and find the y value of where that begins. Can someone help me?

Best Answer

I'm not sure about the question. Perhaps you are looking for this:
curvature = diff(diff(x));
find(curvature < 1e-6)
Related Question