Clear Filters
Clear Filters

Choosing one answer from 3 in Solve

3 views (last 30 days)
i solved a eq with command solve() and get answer -1.35-4.59i , -0.136-4.59i , 1.18+9.18e-41i
i need just real part of positive answer,1.18 from these answers. i want to store this answer in Array, but i have get error because there are 3 answers
thanks

Accepted Answer

James Tursa
James Tursa on 19 Sep 2015
To get the real part of the 3rd element, e.g.,
>> x = [-1.35-4.59i , -0.136-4.59i , 1.18+9.18e-41i]
x =
-1.3500 - 4.5900i -0.1360 - 4.5900i 1.1800 + 0.0000i
>> real(x(3))
ans =
1.1800

More Answers (0)

Community Treasure Hunt

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

Start Hunting!