MATLAB Answers


How can I calculate the slope of third order polynomial fit

Asked by Lameck Amugongo on 12 Jul 2019
Latest activity Commented on by Lameck Amugongo on 12 Jul 2019
I have a third order polynomial fit. I would like to calculate the slope of the fit. Any ideas on how i can do this? Is possible to obtain this from the coefficients?
[p,S] = polyfit(x,y,3);
[y_fit,delta] = polyval(p,x,S);


Sign in to comment.




1 Answer

Answer by John D'Errico
on 12 Jul 2019

Is there a reason why you would not think to differentiate it?
help polyder

  1 Comment

I would just want to see if the measurement is decreasing/increasing/remaining constant overtime.
for example, [p,S] = polyfit(x,y,1);
p(1) will give the slope of the fit.
How can i get the same slope from high order fit e.g. [p,S] = polyfit(x,y,3); or [p,S] = polyfit(x,y,2);?

Sign in to comment.