2d plot for imaginary

3 views (last 30 days)
Gun
Gun on 25 Feb 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.

Accepted Answer

the cyclist
the cyclist on 25 Feb 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?

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!