Not able to add white noise to signals
Afficher commentaires plus anciens
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 commentaires
dpb
le 4 Jan 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
le 4 Jan 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
le 6 Jan 2024
Walter Roberson
le 6 Jan 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
le 6 Jan 2024
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Waveform Generation dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
