plotting an array of doubles
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (3)
Azzi Abdelmalek
am 5 Apr. 2013
Use
snr1(i)
2 Kommentare
Azzi Abdelmalek
am 5 Apr. 2013
Bearbeitet: Azzi Abdelmalek
am 5 Apr. 2013
In your case, the counter is n not i then use
snr1(n)
Carlos
am 5 Apr. 2013
He means that you should do
for n =1:1:5001
snr1(n) = rms(input(n))/ rms(out(n));
end
0 Kommentare
Jan
am 5 Apr. 2013
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Antennas, Microphones, and Sonar Transducers finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!