문제

i would like to ask help about how to generate different noises in signal processing,according to this definition

http://en.wikipedia.org/wiki/Colors_of_noise

where for white noise alpha=0;,and for different noises we have different values of alpha,i prefer to have code in matlab,so please help me to write this code

도움이 되었습니까?

해결책

You can use this code. It is very straigthforward:

function [W,t]= colornoise(a,b,T,N)
 randn('state',100);      %fixing the state of generator
 dt=T/N;
 dW=sqrt(dt)*randn(1,N);

 R=4;                      %fixed for this computation
 L=N/R;
 Xem=zeros(1,L);
 Xzero=0;
 Xtemp=Xzero;
 Dt=R*dt;

 for j=1:L
    Winc=sum(dW(R*(j-1)+1:R*j));
    Xtemp=Xtemp+a*Dt*Xtemp+b*Winc;
    Xem(j)=Xtemp;
 end

 W=[Xzero,Xem];
 t=[0:Dt:T]

where a,b (intensity of white noise) and T (the upper limit to time vector), N (the no. of samples which essentially defines the step size

다른 팁

Generate a pink noise signal 2048 samples in length.

hcn = dsp.ColoredNoise('InverseFrequencyPower',1,'SamplesPerFrame',2048);
x = step(hcn);
plot(x);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top