plotting an array of doubles

3 ビュー (過去 30 日間)
ksew ksew
ksew ksew 2013 年 4 月 5 日
im trying to plot an array with length of (5001 x 101 double) and need to store then in another array. I am using the following code to do so however only 1 values is being stored what im doing wrong
% code
for n =1:1:5001
snr1 = rms(input(n))/ rms(out(n));
end
end

回答 (3 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 4 月 5 日
  2 件のコメント
ksew ksew
ksew ksew 2013 年 4 月 5 日
編集済み: Azzi Abdelmalek 2013 年 4 月 5 日
i did this still nothing works
for n =1:1:5001
snr1(i) = rms(input(n))/ rms(out(n));
end
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 4 月 5 日
編集済み: Azzi Abdelmalek 2013 年 4 月 5 日
In your case, the counter is n not i then use
snr1(n)

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


Carlos
Carlos 2013 年 4 月 5 日
He means that you should do
for n =1:1:5001
snr1(n) = rms(input(n))/ rms(out(n));
end

Jan
Jan 2013 年 4 月 5 日
The suggested methods might work partially only, and this means, that they fail. You want a "5001 x 101 double" array, such that I guess the right hand side replies an [1 x 101] vector. Then:
snr1 = zeros(5001, 101); % Pre-allocate for speed!!!
for n = 1:5001
snr1(n, :) = rms(input(n)) / rms(out(n));
end
Using "input" as name of a variable has the disadvantage, that it shadows the built-in function with the same name. Such shadowing causes unexpected troubles frequently.

カテゴリ

Help Center および File ExchangeAntennas, Microphones, and Sonar Transducers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by