comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Random numbers with predefined spectral density
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Random numbers with predefined spectral density [message #4853] Mon, 21 August 1995 00:00 Go to next message
hahn is currently offline  hahn
Messages: 108
Registered: November 1993
Senior Member
Hi,

I want to calculate random numbers with other than white noise
spectrum. The noise spectrum (amplitude vs. frequency) is
given and I need random numbers that adhere to this spectrum.

Actually, the spectrum is given by a FIR filter of order 12:
coeff = [ 1.48, 1.64, 0.927, ..., 3.1e-3]

How to proceed from here ?

Norbert Hahn
Re: Random numbers with predefined spectral density [message #4926 is a reply to message #4853] Thu, 24 August 1995 00:00 Go to previous message
David Ritscher is currently offline  David Ritscher
Messages: 30
Registered: August 1995
Member
> I want to calculate random numbers with other than white noise
> spectrum. The noise spectrum (amplitude vs. frequency) is
> given and I need random numbers that adhere to this spectrum.

> Actually, the spectrum is given by a FIR filter of order 12:
> coeff = [ 1.48, 1.64, 0.927, ..., 3.1e-3]


Just make a white noise sequence and filter it, using these same
coefficients, as per the following example:

coeff = [ 1.48, 1.64, 0.927, 0, 0, 3.1e-3]
n_samples = 10000

n_coef = n_elements(coeff)
n_samples = 10000 + 2*n_coef

white = randomn(seed, n_samples)
colored = convol(white, coeff) ;filter the white noise source
; throw away the first and last values, some of which were not filtered:
colored = colored(n_coef:n_samples-1-n_coef)

; note - although the IDL/PVWave CONVOL funtction is not really a
; convolution (i.e., (convol(a, reverse(b)) really performs the convolution
; of a and b), since this order doesn't change the spectrum of the result,
; this consideration can be ignored.


--

David Ritscher

Raum 47.2.279
Zentralinstitut fuer Biomedizinische Technik (ZIBMT)
Universitaet Ulm
D-89069 ULM
Germany

Tel: ++49 (731) 502 5313
Fax: ++49 (731) 502 5343
or 5317
internet: david.ritscher@zibmt.uni-ulm.de
Re: Random numbers with predefined spectral density [message #4945 is a reply to message #4853] Tue, 22 August 1995 00:00 Go to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <41ab22$jp5@rs18.hrz.th-darmstadt.de>, hahn@hrz.th-darmstadt.de (Norbert Hahn) writes:
|>
|> I want to calculate random numbers with other than white noise
|> spectrum. The noise spectrum (amplitude vs. frequency) is
|> given and I need random numbers that adhere to this spectrum.
|>
|> Actually, the spectrum is given by a FIR filter of order 12:
|> coeff = [ 1.48, 1.64, 0.927, ..., 3.1e-3]
|>
|> How to proceed from here ?
|>
|> Norbert Hahn

Simply produce white noise, and filter it with your desired noise
spectrum (beware of the difference between *amplitude* and the
*power* spectrum).

Given N = Noise amplitude vs. frequency, an array with NN elements,
you simply use:

NOISE = fft( fft(randomn(seed,NN),-1)*N , 1)

You should also include some renormalization of the total power
in your noise, of course.

Stein Vidar
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Compound widget problem
Next Topic: IDL -> Fortran: Summary

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 23:15:38 PDT 2025

Total time taken to generate the page: 0.24176 seconds