Re: randomized white noise = white noise?
- From: "Tom Bruhns" <k7itm@xxxxxxx>
- Date: 25 May 2006 09:09:01 -0700
Hi James -- and Asa too of course...
Scilab is "freeware" and has a rich set of functions to deal with
linear system analysis. I suppose you can do the same in Matlab. It's
about the same number of lines of code just typed into the interpreter
as in your program to generate the response, generate a matching "true
pink" response, and plot the difference. I use a state-space notation
to put in the design:
a=[1-1/256,0,0;0,1-1/16,0;0,0,.5];
b=[3/32;1/4;1+1/16]
c=[1,1,1]; d=3/16;
pinkfilt=syslin('d',a,b,c,d)
hz=ss2tf(pinkfilt) // z-domain transfer function
[pinkmag,fr]=frmag(hz,22051) // magnitude response
// 22051 points linearly spaced means a point every Hz
// Now drop 0Hz point which just causes a divide by
// zero below if you don't. Also makes the index
// of each point be the freq in Hz
pinkmag=pinkmag(2:22051); fr=fr(2:22051);
const=pinkmag(1000)^2*fr(1000) // Gen. true pink response
truepinkmag=sqrt(const ./ fr);
pinkdb=20*log10(pinkmag);
truepinkdb=20*log10(truepinkmag);
errordb=pinkdb-truepinkdb;
plot(errordb(20:20000))
You can search "by hand" for min and max values, or get an idea where
to look from the graph and use min and max functions on ranges from
errordb.
[peak,idx]=max(errordb(2001:8000))
//remember to add idx to 2001 for Hz where the peak occurs
Cheers,
Tom
James Waldby wrote:
Tom Bruhns wrote:
[re code,
<generate white>
tw = white/16;
tmp = tw*3;
b0 = b0 - b0/256 + tmp/2;
b1 = b1 - b1/16 + tw/4;
b2 = b2/2 + white + tw;
tmp += b0 + b1 + b2;
outp (tmp/256, PORTB);
approximating Asa's
b0 = 0.99765 * b0 + white * 0.0990460;
b1 = 0.96300 * b1 + white * 0.2965164;
b2 = 0.57000 * b2 + white * 1.0526913;
tmp = b0 + b1 + b2 + white * 0.1848;
]
Assuming you meant for b1 to have white/4, not tw/4, that doesn't do
Right - should have been b1 = b1 - b1/16 + white/4;
too bad, and is a good illustration of being clever with coefficients.
The ripples in the error are not quite as well behaved, but the
peak-to-peak error is actually less than with the original
coefficients. If I match up to zero error at 1kHz, then 20Hz is
-0.907dB, peak at 31Hz of -0.552dB, valley at 111Hz of -1.420dB, peak
at 4196Hz of +1.156dB, valley at 18872Hz of -1.837dB.
Thanks for the analysis! What program, or spread***,
do you use to compute response?
But we still don't know what's good enough for the application...
.
- Follow-Ups:
- Re: randomized white noise = white noise?
- From: acannell
- Re: randomized white noise = white noise?
- References:
- randomized white noise = white noise?
- From: acannell
- Re: randomized white noise = white noise?
- From: Don Lancaster
- Re: randomized white noise = white noise?
- From: Tom Bruhns
- Re: randomized white noise = white noise?
- From: acannell
- Re: randomized white noise = white noise?
- From: Tom Bruhns
- Re: randomized white noise = white noise?
- From: acannell
- Re: randomized white noise = white noise?
- From: Tom Bruhns
- Re: randomized white noise = white noise?
- From: acannell
- Re: randomized white noise = white noise?
- From: James Waldby
- Re: randomized white noise = white noise?
- From: Tom Bruhns
- Re: randomized white noise = white noise?
- From: James Waldby
- randomized white noise = white noise?
- Prev by Date: Re: Welding -- what to do about HUGE 2" arcs
- Next by Date: Re: Welding -- what to do about HUGE 2" arcs
- Previous by thread: Re: randomized white noise = white noise?
- Next by thread: Re: randomized white noise = white noise?
- Index(es):