How to extract just one value?

조회 수: 5 (최근 30일)
jchris14
jchris14 2014년 4월 25일
댓글: jchris14 2014년 4월 25일
Hi,
suppose I have a polynomial plot and find roots using the "roots" command and i get vector with 2 or more values. How do i just get one particular value out of the 2 or more values?
Thanks

채택된 답변

Walter Roberson
Walter Roberson 2014년 4월 25일
Index it. For example,
r = roots([9, 2, 4, -7]);
disp(r(1))
If you want to look for real roots then
r(imag(r)==0)
will return only real-valued roots

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by