How do I directly assign the two roots of a quadratic to an array?

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

답변 (1개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2013년 2월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by