Filter löschen
Filter löschen

Solve eqn and get real part of solution in MatLab R2011b

1 Ansicht (letzte 30 Tage)
ly
ly am 9 Okt. 2015
Kommentiert: ly am 9 Okt. 2015
I use MatLab R2011b and want to solve an eqn and get the real part of solution. This is the code:
...
s=solve(y);
...
And this is solution: s =
0.3971412063699492853956558622094
-0.8763850946630804323385057262195
- 0.13537805585343442652857506799495 - 0.83663803641655759940578883730279*i
- 0.13537805585343442652857506799495 + 0.83663803641655759940578883730279*i
As you can see "s" has two solutions are real (0.3971 and -0.87638) and two imaginary (with i). The real solution is needed. Which command can be used in this case? Give the example is helpful.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 9 Okt. 2015
s(imag(s)==0)

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics and Optimization finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by