Not able to add white noise to signals
Mostra commenti meno recenti
for i = 1:numFreqs
curSig=signals(:, i);
sysamp1num1=amp1.gettransferfunction();
cursnr(:, i)=snr(signals(:, i), noiseamount);
curnoisysignal(:, i)=awgn(signals(:, i), cursnr(:, i));
outputs(:, i) = lsim(sysamp1num1,curnoisysignal(:, i), t);
end
Essentially i have a swept band of signals with diff. frequencies (as indcated by the for loop), and I do have a noise figure value that is consistent for all of the signals I am looking to add the awgn to (noiseamount in my code). However, for every output signal for each "i" respective frequency the output signal happens to be the same exact signal, when I can clearly see that the vector of cursnr has a different value for each value of its array.
Anyone have any solution ideas?
5 Commenti
dpb
il 4 Gen 2024
Too much undefined in the above code snippet to be able to tell anything...post a minimum working example that illustrates the problem. In particular, sysamplnum1 is dependent upon whatever amp1 is, and it's not referenced at all...
NOTA BENE: In creating the above, it's more than likely you'll find the problem in your existing code.
Walter Roberson
il 4 Gen 2024
snr(signals(:, i), noiseamount) with scalar noiseamount is not a documented syntax for snr() .
However, it would be documented if noiseamount is a vector or array
Rohan Gulur
il 6 Gen 2024
Walter Roberson
il 6 Gen 2024
It turns out that it is defined to use snr(signals(:, i), noiseamount) and is treated the same as snr(signals(:, i), noiseamount, 6)
Note that noiseamount would be treated as Fs (sampling frequency) in this syntax.
Rohan Gulur
il 6 Gen 2024
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Waveform Generation in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
