# How to add noise signal in matlab

Status
Not open for further replies.

#### Communications_Engineer

##### Advanced Member level 3 matlab add noise

miriyala said:
>> N= 200;
T=0.05;
t=(0:N-1)*T;
s=sin(2*pi*120*t);
subplot(3,1,1),plot(t,s);
fft_s=fft(s);
subplot(3,1,2),plot(t,real(fft_s));
subplot(3,1,3),plot(t,imag(fft_s));

so , how to add noise to this coading ???????? pls send me reply. thanks

What type of noise do you want, if you want white noise, use the awgn command, so if I append it to your code,

T=0.05;
snr = 15;
t=(0:N-1)*T;
s=sin(2*pi*120*t);
subplot(3,1,1),plot(t,s);
s_noisy = awgn(s,snr);
fft_s=fft(s_noisy);subplot(3,1,2),plot(t,real(fft_s));
subplot(3,1,3),plot(t,imag(fft_s));

So this program will plot the real & quadrature part of the sine wave in frequency domain after it has been corrupted by noise so that the Signal to Noise ratio is 15 deci-Bells. It would also plot the sine wave in time domain

Hope you understood

---------------------------------------------------------------------------------------------
groups.yahoo.com/group/telecom_research

[/b]

### miriyala

Points: 2
Helpful Answer Positive Rating

#### hansmuller

##### Member level 1 add noise matlab

randn('state',0);
x=sin(2*pi*t);
x=x+0.5*randn(size(t));

In this code you add to signal x a random noise in size t.

### miriyala

Points: 2
Helpful Answer Positive Rating

#### Communications_Engineer

##### Advanced Member level 3 how to add noise to signal in matlab

miriyala said:
Thanks for ur reply, this helped me a lot. but how to add vibrations noise, to the below programe

>> N= 200;
T=0.05;
t=(0:N-1)*T;
s=sin(2*pi*120*t);
subplot(3,1,1),plot(t,s);
fft_s=fft(s);
subplot(3,1,2),plot(t,real(fft_s));
subplot(3,1,3),plot(t,imag(fft_s));

........... pls send me a reply...thanks

What do you mean vibration? do you mean random phase offset?

You want me or hansmuller to give you the solution? If its your hw, you should do it your self, even though I have no problem helping you.

If you are indeed asking about the vibration as a phase then add a variable 'theta' in the sine term and give it values "theta = randint(1,1,[0 pi])" so that a random phase would be selected

Status
Not open for further replies.