Hi everyone
I'm trying to add a white noise to my signal and simulate it for different SNR values.
But I'm not sure if i should use randn() or awgn().
For instance I don't understand why these two methods deliver different signals in my code.
t=linspace(0,120,8000);
x=sin(2*pi*0.01.*t+pi/3).*cos(2*pi*0.01.*t+pi/3);
n=2*randn(size(x));
xn=x+n;
SNR=snr(xn,n);
x2=awgn(x,SNR,'measured');
subplot(2,1,1);plot(t,xn);
title('Signal with white noise using randn');
subplot(2,1,2);plot(t,x2);
title('Signal with white noise using awgn');
I'd be very grateful for your clarifications and suggestions!
2 Comments
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/625453-difference-between-randn-and-awgn-in-adding-white-noise-to-a-signal#comment_1084738
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/625453-difference-between-randn-and-awgn-in-adding-white-noise-to-a-signal#comment_1084738
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/625453-difference-between-randn-and-awgn-in-adding-white-noise-to-a-signal#comment_1085003
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/625453-difference-between-randn-and-awgn-in-adding-white-noise-to-a-signal#comment_1085003
Sign in to comment.