I want to calculate roots of a polynomial whose coefficients are functions of x where x assume values between an interval
2 ビュー (過去 30 日間)
古いコメントを表示
Let x =[0:1:10]; polynomial = [ 1 sin(x) x.^3 x]; let v1,v2 and v3 be the three roots of given polynomial in v whose coefficients are functions of x. I want to plot a graph between v1 and x.
6 件のコメント
John D'Errico
2017 年 10 月 21 日
So why did you set x=pi/18?
You were asked to solve this problem for x varying from 0 to 10, NOT just at one value of x.
If the polynomial has three roots, what does v1 versus v2 and v3 mean? Roots need not be provided in any specific order. So how are you supposed to choose v1?
採用された回答
Matt J
2017 年 10 月 21 日
編集済み: Matt J
2017 年 10 月 21 日
You cannot use ROOTS on multiple polynomials at a time. You will have to use a loop over x(i),
for i=1:numel(x)
p =[1 sin(x(i)) x(i).^3 x(i)];
r{i}=roots(p);
%More code...
end
3 件のコメント
Matt J
2017 年 10 月 21 日
clear 'r' from memory first, or better yet pre-allocate,
r=cell(1,numel(x));
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Polynomials についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!