How can I calculate the slope of third order polynomial fit

조회 수: 12 (최근 30일)
Lameck Amugongo
Lameck Amugongo 2019년 7월 12일
댓글: Lameck Amugongo 2019년 7월 12일
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);

답변 (1개)

John D'Errico
John D'Errico 2019년 7월 12일
Is there a reason why you would not think to differentiate it?
help polyder
  댓글 수: 1
Lameck Amugongo
Lameck Amugongo 2019년 7월 12일
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);?
Thanks

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

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by