user466534
user466534

Reputation:

does white noise without mean zero do some changes?

again my question is related to white noise ,but with different meaning.let us compare following two code.first

function [ x ] = generate(N,m,A3)
f1 = 100;
f2 = 200;
T = 1./f1;
t = (0:(N*T/m):(N*T))'; %'
wn = rand(length(t),1).*2 - 1;
x = 20.*sin(2.*pi.*f1.*t) + 30.*cos(2.*pi.*f2.*t) + A3.*wn;
%[pks,locs] = findpeaks(x);
 plot(x)
end

using generate(3,500,10)

graph of this code is following

enter image description here

but let us change our code so that it makes zero mean with white noise

function [ x ] = generate1(N,m,A3)
f1 = 100;
f2 = 200;
T = 1./f1;
t = (0:(N*T/m):(N*T))'; %'
wn = rand(length(t),1).*2 - 1;
mn=wn-mean(wn);
x = 20.*sin(2.*pi.*f1.*t) + 30.*cos(2.*pi.*f2.*t) + A3.*mn;
%[pks,locs] = findpeaks(x);
 plot(x)
end

and graph is following enter image description here

if we compare these two picture,we could say that it is almost same,just some changes,so does matter if we make zero mean or not?for real analysis,like for finding peaks and so on.thanks very much

UPDATED: there is updated code

function [ x ] = generate1(N,m,A3)
f1 = 100;
f2 = 200;
T = 1./f1;
t = (0:(N*T/m):(N*T))'; %'
wn = randn(length(t),1); %zero mean variance 1
x = 20.*sin(2.*pi.*f1.*t) + 30.*cos(2.*pi.*f2.*t) + A3.*wn;
%[pks,locs] = findpeaks(x);
 plot(x)
end

enter image description here

and it's picture

Upvotes: 0

Views: 1212

Answers (2)

fatihk
fatihk

Reputation: 7919

Your initial noise is uniformly distributed between -1 & +1

Your second noise is also uniformly disributed between -1 & +1, because mean is already zero, subtracting it is meaningless

in order to obtain white noise you can use randn() function:

wn = randn(length(t),1); %zero mean variance 1

You may not observe any much difference again if your noise coefficient A3 has a much lower value compared to 20 & 30 which are the coefficients of your signal.

In order to find peaks, adding noise may not serve any purpose because noise tends to decrease the information content of signals

Upvotes: 1

mpenkov
mpenkov

Reputation: 21906

What is the value of mean(wm)? If it is close to zero, then no, it does not matter.

Technically, white noise has zero mean by definition.

Upvotes: 1

Related Questions