필터 지우기
필터 지우기

how to generate white noise of particular frequency in matlab ?

조회 수: 41 (최근 30일)
Aniket
Aniket 2013년 4월 14일
Hello,
I want to generate white noise of particular frequency say 4hz . the covariance is 0.01.
how should i do this in matlab ?

채택된 답변

Youssef  Khmou
Youssef Khmou 2013년 4월 14일
hi,
I think you are talking about Colored noise, and bandwidth of 4hz not particular frequency,
White noise contains all the frequencies i.e flat Spectral density, so colored noise can be generated by passing the white noise through low pass filter , here is an example :
x=randn(1000,1); % Additive white Gaussian noise .
% Coefficients
a=1;
b=[1 1];
y=filter(b,a,x);
psd(x);axes=axis, title(' AWGN');
figure,psd(y);axis(axes),title(' Colored Noise');
The colored noise has approximately 0.7 Hz of bandwidth as normalized frequency . so you can adapt the parameters a and b .....
  댓글 수: 2
Aniket
Aniket 2013년 4월 14일
thank you, that i was asking exactly....how should i adjust frequency at 4hz or near to 4hz ?
should i adjust a and b parameters ?
Youssef  Khmou
Youssef Khmou 2013년 4월 14일
hi, yes the frequency depends on the parameters a,b or call them the coefficients numerator/denominator of the transfer function of the filter, if you find that difficult, here is the easy way : transform the noise into frequency domain, adjust the frequency and apply the Inverse fourier transform, here is an example :
x=randn(1000,1);
fx=fft(x); % frequency domain .
N=length(fx);
p=0.4/2; % desired bandwidth percentage, /2 because fft is TWO sided !!!
P=round(p*N);
fx(P+1:end)=0;
y=ifft(fx);
psd(x), axes=axis;title(' PSD AWGN');
figure,psd(y), axis(axes), title(' Coloredn');
figure, plot(x), hold on, plot(real(y),'r'), hold off

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Wayne King
Wayne King 2013년 4월 14일
편집: Wayne King 2013년 4월 14일
White noise cannot be of a particular frequency. White noise by definition is a sequence of uncorrelated random variables. The autocorrelation sequence of a white noise process is the Kronecker delta sequence.
Equivalently, the power spectral density of white noise is constant.
You can easily generate a white noise sequence in MATLAB with a variance of 0.01. You have not specified what distribution the random variables in the white noise sequence should follow (it is not always Gaussian). In this case I'll assume Gaussian. Let N be the length of your sequence.
N = 1000;
noise = sqrt(0.01)*randn(N,1);

카테고리

Help CenterFile Exchange에서 Spectral Estimation에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by