필터 지우기
필터 지우기

how to generate an abitrary length colored noise when the PSD is know !

조회 수: 2 (최근 30일)
abraham
abraham 2014년 8월 20일
댓글: Bjorn Gustavsson 2014년 10월 7일
I want to generate colored noise samples of arbitrary length, I have the PSD of the noise in a vector of 512 elements !
  댓글 수: 3
abraham
abraham 2014년 8월 21일
Thanks for the response, but the point is that doing as you explained , I can only generate a noise with the same length as the H(w) (the same length as the psd vector). I would like to have a large noise vector, greater than the length of the psd vector.
Bjorn Gustavsson
Bjorn Gustavsson 2014년 10월 7일
Presumably your signal is then bandlimited to frequencies corresponing to your 512-samples wide PSD, meaning that the PSD at higer frequencies is zero - so you should be able to simply pad the PSD with zeros up to the desired length.

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

답변 (2개)

Image Analyst
Image Analyst 2014년 8월 20일
You need to use inverse transform sampling. By doing that you can get any distribution you want from a uniform distribution. See http://en.wikipedia.org/wiki/Inverse_transform_sampling
I've also attached a demo where I pull random values from a Rayleigh distribution. Feel free to modify it.
  댓글 수: 4
Image Analyst
Image Analyst 2014년 10월 7일
Abraham: Not sure why you never responded. I just made up another demo for someone else that does an inverse power law, and thought you'd also be interested. See attached demo.
With this demo, you can adapt it to any PDF you want since it calculates the CDF numerically and you don't need to be able to integrate the PDF formula analytically with calculus. So you should be able to modify it for your PDF. Please mark the answer as accepted if it helps you.
Bjorn Gustavsson
Bjorn Gustavsson 2014년 10월 7일
That would lead to a random-number sequence with a given probability distribution function, but the OP asked for a given power spectral density, as far as I understood the question.

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


Youssef  Khmou
Youssef Khmou 2014년 8월 21일
You proceed using Inverse Fourier transform , here is how you can start , let us consider zero mean random variable of length 200 :
x=randn(200,1);
f=fft(x); % Discret Fourier Transform with same length
p=f.*conj(f); % Power
figure; plot(p)
C=real(ifft(f)); % inverse transform of the power
figure; plot(C,x) %
the original signal or the ones resulting from inverse transformation are similar, so suppose you have vector of Power spectrum, you ifft with the desired length N :
X=real(ifft(x,N));

Community Treasure Hunt

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

Start Hunting!

Translated by