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 
Return to the default flat view Create a new topic Submit Reply
Re: Random numbers with predefined spectral density [message #4926 is a reply to message #4853] Thu, 24 August 1995 00:00 Go to previous messageGo 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
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Compound widget problem
Next Topic: IDL -> Fortran: Summary

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

Current Time: Mon Oct 27 03:04:26 PDT 2025

Total time taken to generate the page: 0.02740 seconds