Borrar filtros
Borrar filtros

Finding real and imaginary part of an equation

2 visualizaciones (últimos 30 días)
Ritu Bhalodia
Ritu Bhalodia el 4 de Dic. de 2023
Comentada: Torsten el 4 de Dic. de 2023
syms U P
P = sqrt((((20*U^2) -15) + sqrt((400*U^4)+ (1080*U^2) + 25 -600 - 450 - (1125/U^2))) / ((36*U^2) + 30));
p = solve(P);
real_part_U = real(p);
imaginary_part_U = imag(p);
disp(real_part_U);
disp(imaginary_part_U);
plot (p,imaginary_part_U);
Warning: Imaginary parts of complex X and/or Y arguments ignored.
I have an equation of p in terms of U for which I need to find real and imaginary part of p in terms of U and plot the imag(p) wrt U. I don't get the correct graph by using above code. What am I doing wrong?

Respuestas (2)

Walter Roberson
Walter Roberson el 4 de Dic. de 2023
You extracted the real part into a variable but you plot() the complex variable.
syms U P
P = sqrt((((20*U^2) -15) + sqrt((400*U^4)+ (1080*U^2) + 25 -600 - 450 - (1125/U^2))) / ((36*U^2) + 30));
p = solve(P);
real_part_U = real(p);
imaginary_part_U = imag(p);
disp(real_part_U);
disp(imaginary_part_U);
plot(real_part_U,imaginary_part_U);
  2 comentarios
Ritu Bhalodia
Ritu Bhalodia el 4 de Dic. de 2023
That still doesn't give me the answer I want. Note that p is a solution of an equation I solved manually. I need to separate the p equation in terms of real and imaginary part in order to plot imaginary part wrt U.
Torsten
Torsten el 4 de Dic. de 2023
It's not easy to understand what you want.
You are given P, you solve
P = sqrt((((20*U^2) -15) + sqrt((400*U^4)+ (1080*U^2) + 25 -600 - 450 - (1125/U^2))) / ((36*U^2) + 30));
for U and after this, you want to plot imag(P) vs. U ? What if U is complex ?

Iniciar sesión para comentar.


Torsten
Torsten el 4 de Dic. de 2023
Movida: Torsten el 4 de Dic. de 2023
U = 0:0.1:10;
P = sqrt((((20*U.^2)-15) + sqrt((400*U.^4)+ (1080*U.^2) + 25 -600 - 450 - (1125./U.^2)))./((36*U.^2) + 30));
Pimag = imag(P);
plot(U,Pimag)

Categorías

Más información sobre Formula Manipulation and Simplification en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by