2d plot for imaginary

조회 수: 2 (최근 30일)
Gun
Gun 2011년 2월 25일
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.

채택된 답변

the cyclist
the cyclist 2011년 2월 25일
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
Gun
Gun 2011년 2월 25일
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by