フィルターのクリア

any idea why i'm getting this error?

1 回表示 (過去 30 日間)
ocsse
ocsse 2018 年 3 月 25 日
コメント済み: Rena Berman 2018 年 4 月 5 日
why i'm getting Subscript indices must either be real positive integers or logicals.
m = zeros(4,500);
n_trig = 3;
n = (0:Harm).';
f0 = 1/T;
fs = samples / T;
n = (0:n_trig).';
wnt = 2*pi*f0*n*t;
ft = exp((2 - t) / 4);
s1 = (1/T) * sum(ft) / fs;
s2 = (2/T) * ft * cos(2*pi*f0*n*t).' / fs;
s3 = (2/T) * ft * cos(2*pi*f0*n*t).' / fs;
s = s1 + s2*cos(wnt) + s3*sin(wnt);
for n = 0:3
m(n,:) = s(n);
end
thanks
  1 件のコメント
Rena Berman
Rena Berman 2018 年 4 月 5 日
(Answers Dev) Restored edit

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2018 年 3 月 25 日
You have
for n = 0:3
m(n,:) = s(n);
end
When n = 0 (the first value for n), you are trying to do m(0,:) = s(0) . That is not valid, as MATLAB indices start at 1.
By the way, why do you have the line
n = (0:Harm).';
when you overwrite n three lines later?

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by