Not able to add white noise to signals
古いコメントを表示
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 件のコメント
dpb
2024 年 1 月 4 日
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
2024 年 1 月 4 日
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
2024 年 1 月 6 日
Walter Roberson
2024 年 1 月 6 日
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
2024 年 1 月 6 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Waveform Generation についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
