Multiple for loops issue

1 Ansicht (letzte 30 Tage)
Chanaka Navarathna
Chanaka Navarathna am 27 Jan. 2019
I need to run this code and ultimately generate the numbers for SNRatio. Did I use the for loop in the correct way?
It gives me infinity at the end. Is there a way to store the number generated in each for loop and carry it to the final step?
W=1000; %Initial average excitation power
W1=W+rand(1,W)*10; %Power fluctuation
for M = [10 100] %Magnification factor
W2=W1*M;
end
for i=1:W2 %power fluctuation
end
S_i = 100; %Initial Signal
S=S_i+rand(1,S_i)*10; %Generate a set of multiple numbers for signal
for S_f=1:S %final signal
meanS=mean(S_f);
stdeviationS=std(S_f);
SNRatio = mean(S_f)/std(S_f)
end

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements 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!

Translated by