MATLAB Answers

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

1 ビュー (過去 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 件のコメント

表示 4 件の古いコメント
Rik
Rik 2017 年 12 月 5 日
This sounds like you want to interpolate/resample your data. You can find dozens of examples using your favorite internet search engine.
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).

サインイン to comment.

回答 (0 件)

サインイン してこの質問に回答します。

タグ


Translated by