Solving differential equation with imaginary unit

rownania.JPG
I have these equations. k and sigma are variables which i can set as i want, "j" is imaginary unit. I wrote this code:
d = 2;
k = 2;
syms Af(z) Ab(z)
ode1 = diff(Af) == 1j*d*Af + 1j*k*Ab;
ode2 = diff(Ab) == -1j*d*Ab - 1j*k*Af;
odes = [ode1; ode2]
cond1 = Af(0) == 1;
cond2 = Ab(0) == 0;
conds = [cond1; cond2];
[AfSol(z), AbSol(z)] = dsolve(odes,conds)
fplot(AfSol)
hold on
fplot(AbSol)
grid on
legend('AfSol','AbSol','Location','best')
but graph is not painted. I don't know why.

 Akzeptierte Antwort

Star Strider
Star Strider am 14 Mai 2019
The plot functions onnly plot real values. If you ask for the imaginary parts, you will see the results:
fplot(imag(AfSol))
hold on
fplot(imag(AbSol))
grid on
legend('AfSol','AbSol','Location','best')

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by