Error:Subscript indices must either be real positive integers or logicals.

조회 수: 2 (최근 30일)
[EDIT: Thu May 26 14:57:40 UTC 2011 - Reformat - MKF]
My code
w=[-1000:1:1000]*(4*pi/2000);
x=exp(-i*w/2).*sin(3*w);
mag=abs(x);
arg=angle(x);
realX=real(x);
imaginaryX=imag(x);
error
baitap_1_15 at 5
real_x=real(x);
??? Subscript indices must either be real positive integers or logicals.
Can you help me?

채택된 답변

Laura Proctor
Laura Proctor 2011년 5월 26일
Try the command
which real
I suspect that you have a variable defined in your workspace that is named real when you are really trying to call the function real. If this is the case, clear real and then try the code.
clear real
  댓글 수: 1
Matt Fig
Matt Fig 2011년 5월 26일
To give an example,
real = 9; % Masks the MATLAB function!
x = 7+6i;
real(x) % This is an index into the variable real, not a func call!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Hilbert and Walsh-Hadamard Transforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by