How can i add white Gaussian noise to signal.
Now, i'm using awgn function but it doesn't work.
Am i give an incorrect parameter?
EDITED
x = -2:.002:2;
% Initail variables
M = 0;
V = 500*10^(-6);
% Creating a singal
T = -pi + (pi+pi)*rand(1,1);
S = (13.5)*cos(2*pi*x+T);
% Creating Noise singal
W = M+sqrt(V)*rand(1,2500);
% Adding Noise to signal // This doesn't work
SW = awgn(S,W,'measured');
% or this doesn't work too
SW = S + W;
Thanks in advance.
Your vectors don't have the same size.
S
is 1x2001 andW
is 1x2500. TryThen you can just add the signals by
As Kostya already wrote,
awgn
can be used if you know the desired SNR.