Splitting Function into Imaginary and Real

65 Ansichten (letzte 30 Tage)
Dimitrije Ljaljevic
Dimitrije Ljaljevic am 6 Nov. 2019
Kommentiert: Walter Roberson am 7 Nov. 2019
I have a big function (f(w)) with 2 terms in it, and they have the variable w and imaginary number j in the denominator, and I have to take the conjugate (of each term since they have a different denominator) and then split it up into an imaginary function (to graph) and a real function (to graph) anyone know how to do that with MATLAB or is it not possible and I have to do it by hand

Antworten (1)

Nicolas B.
Nicolas B. am 7 Nov. 2019
you can use the functions real() and imag() to extract respectively the real and imaginary part of a number. It also accepts vector/matrix inputs.
  1 Kommentar
Walter Roberson
Walter Roberson am 7 Nov. 2019
Based upon the description, I suspect that symbolic expressions are being used. real() and imag() can be used on symbolic expressions as well. If possible, you should use assumptions to set w to be real valued if that makes sense:
syms w real
if w is not real-valued then it is not uncommon for it to be easier to use
syms wr wi real
w = wr+1i*wi
and then it is common for real() and imag() to be able to separate out the parts and common for conj() to be able to generate explicit expressions instead of having conj() calls hanging around.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Mathematics 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