Question

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

Was it helpful?

Solution

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

OTHER TIPS

Generate a pink noise signal 2048 samples in length.

hcn = dsp.ColoredNoise('InverseFrequencyPower',1,'SamplesPerFrame',2048);
x = step(hcn);
plot(x);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top