Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How can we compute the derivative of polynomials?

1 回表示 (過去 30 日間)
Omar B.
Omar B. 2020 年 10 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
How can we compute the derivative of the (m-1) polynomials at a point?
I got the following error:
The following error occurred converting from sym to double:
Unable to convert expression into double array.
Error in untitled (line 42)
p(1)=((x-alpha(1))*p0)/beta(1);
syms x
p0=1;
x0=2;
p(1)=((x-.2)*p0)/.3;
p(2)=((x-.5)*p(1)-.3*p0)/1.3;
dp(1)=eval((subs(diff(p(1),x,1),x,x0)) )
dp(2)=eval((subs(diff(p(2),x,1),x,x0)) )
for j=3:m-1
p(j)=((x-.2)*p(j-1) - .3*p(j-2))/1.3;
dp(j)=eval((subs(diff(p(j),x,1),x,x0)));
end
  11 件のコメント
James Tursa
James Tursa 2020 年 10 月 2 日
Both eval( ) and double( ) work for me with your example code. What is your actual code?
Omar B.
Omar B. 2020 年 10 月 2 日
yes, I got the same results. Thank you so much

回答 (1 件)

David Hill
David Hill 2020 年 10 月 1 日
Why not just use polynomial representation
p = [3 0 -2 0 1 5];
pd=polyder(p);
x=1:10;
val=polyval(pd,x);
  2 件のコメント
Omar B.
Omar B. 2020 年 10 月 1 日
I just here wrote an example , but I need to refer the coefficients to another code. Is there another way?
Walter Roberson
Walter Roberson 2020 年 10 月 2 日
The coedfficients would be in pd

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by