How do I directly assign the two roots of a quadratic to an array?
4 ビュー (過去 30 日間)
古いコメントを表示
Hi,
sorry I'm new to this so I may use wrong terms and such. When using roots for a quadratic, you get 2 values...how do I have these two values assingned to 2 variables directly?
I thought it would be, for example:
[x1, x2] = roots((x^2)-4)
as in x1 = 2 and x2 = -2. But then I get the error 'too many output arguments'.
Thanks
0 件のコメント
回答 (1 件)
Azzi Abdelmalek
2013 年 2 月 12 日
編集済み: Azzi Abdelmalek
2013 年 2 月 12 日
x=roots([1 0 -4]);
x(1)
x(2)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!