Borrar filtros
Borrar filtros

2d plot for imaginary

2 visualizaciones (últimos 30 días)
Gun
Gun el 25 de Feb. de 2011
Sorry for the trouble.I have a question to ask.Below is the code that i have written:
x4 = 0:pi/30:2*pi; % x vector, 0 <= x <= 2*pi, increments of pi/30
x4a=(137.*267.^(1/2).*111819872067690549716262153787.^(1/2).*1i.*(71289 - 2500.*x4^2).^(1/2))./785298692348313600 - (748846716930964699.*x4)./15705973846966272;
y4a=-sqrt(5.34^2-x4a^2);
plot(x4,x4a)
The problem is whenever i simulate it,they are saying Error using ==> mpower Inputs must be a scalar and a square matrix.
I have already put the . and even the imaginary part i have put 1i.What is wrong with it?
Thank you.

Respuesta aceptada

the cyclist
the cyclist el 25 de Feb. de 2011
As you seem to have remembered in some places, but not others, you need ".^" to do element-wise raising to a power. Correcting this error in two places gives:
x4 = 0:pi/30:2*pi; % x vector, 0 <= x <= 2*pi, increments of pi/30
x4a=(137.*267.^(1/2).*111819872067690549716262153787.^(1/2).*1i.*(71289 - 2500.*x4.^2).^(1/2))./785298692348313600 - (748846716930964699.*x4)./15705973846966272;
y4a=-sqrt(5.34^2-x4a.^2);
plot(x4,x4a)
That code runs, but gives a warning about ignoring imaginary parts of your complex input. Maybe you can sort that out yourself?
  1 comentario
Gun
Gun el 25 de Feb. de 2011
Thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB 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