필터 지우기
필터 지우기

Subscript indices must either be real positive integers or logicals. How to solve it?

조회 수: 3 (최근 30일)
Auryn_
Auryn_ 2017년 12월 5일
댓글: Auryn_ 2017년 12월 5일
Hi, I know this is asked very often, but still I don't know how to solve it in my case. This is the code:
M=4;
n = zeros(1,M);
q=[0:M-1]*(2/M);
for i1=1:M
for i2=1:M
n(q)=n(q)+exp(-1i*q*(i1-i2))*A(i1,i2);
end
end
I received this error message: "Subscript indices must either be real positive integers or logicals.""
Could you please help me?
Cheers!
  댓글 수: 7
Lorenzo Meneghetti
Lorenzo Meneghetti 2017년 12월 5일
when you do n(q) q is zero so it gives error
arrays in matlab are accessed with indices starting from 1
also you didn't define A
Auryn_
Auryn_ 2017년 12월 5일
Yes, it's like the Fourier transform directly. I need the points between [0,2\pi).

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by