I have a random signal and I would like to add a random noise to it.
I can add noise to standard signals like Sine, Cosine, Square, sawtooth etc.. by using awgn
or randn
But this doesn't work when I try to add the same noise on a random signal like signal = [200 180 160 120 80 80 70 70 65 50 55 120 10 10];
These are the two approaches which I tried:
signal = [200 180 160 120 80 80 70 70 65 50 55 120 10 10 10]; %original signal
plot(signal)
sigma = 0.07; %noise standard deviation
noisy = signal + sigma*randn(size(signal)); %noisy signal
plot(noisy)
OR
signal = [200 180 160 120 80 80 70 70 65 50 55 120 10 10 10];
s = awgn(signal,10,'measured');
plot([signal s])
How can I add noise to these random signals? and why can't I accomplish this task by using standard commands?
If I understand you question you want to add some noise to your signal with a smaller interval than the sampling frequency of the signal itself.
In this case you can use interp1
in order to interpolate your signal:
signal = [200 180 160 120 80 80 70 70 65 50 55 120 10 10];
n = length(signal);
sinterp = interp1(1:n,signal,1:0.1:n); %interpolation of your signal with interp1(x,y,new_x)
sigma = 10; %a bigger sigma so we can observe the noise.
noisy = sinterp + sigma*randn(size(sinterp));
plot(1:n,signal,'b',1:0.1:n,noisy,'r')