2d plot for imaginary

2 vues (au cours des 30 derniers jours)
Gun
Gun le 25 Fév 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.

Réponse acceptée

the cyclist
the cyclist le 25 Fév 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 commentaire
Gun
Gun le 25 Fév 2011
Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by