Connect with us

analysis software

Discussion in 'Electronic Design' started by John Larkin, Jun 9, 2007.

Scroll to continue with content
  1. John Larkin

    John Larkin Guest

    I have a little problem and could use some FFT-type analysis software.

    We want to digitally generate programmable-bandwidth,
    lowpass/bandlimited Gaussian noise, at constant amplitude. What we
    have is a 4096-point, 16-bit wide RAM feeding a DAC, clocked by a DDS
    based address generator (phase accumulator) running at 128 MHz.

    What I'd like to do is load the ram with a snippet of a bandlimited
    gaussian noise pattern corresponding to, say, 1 volt RMS at the dac
    output. I can generate the 4096 data points on a PC, and copy the data
    into my embedded assembly language program, which can in turn load the
    noise pattern into the ram when my user decides he wants noise on one
    channel (it will also do standard waveforms and arb.) The DDS phase
    accumulate value "plays" the waveform at a variable rate, setting the
    noise bandwidth.

    Since the waveform will be played continuously, I don't want a "seam"
    at the transition from ram address 4095 to 0. It's sort of like a
    360-degree panoramic photograph with no seam anywhere.

    My thinking is this:

    Using some software tool, PowerBasic or one of the math things, define
    an array of 4096 floats. Load the array with random numbers in the
    range -1 to +1.

    Now make a pass through all entries, applying a weighting function
    such as to change the probability distribution from flat to nearly
    Gaussian, with some reasonable crest factor. (I'm not sure this step
    is necessary.)

    The points now look like hell, as they have no adjacent-point
    correlation; they need to be lowpass filtered.

    Filter the points as follows: look at the data as an input array
    arranged as a ring instead of a linear vector. Create an null output
    array. Now we want to lowpass filter the input ring array into the
    output array seamlessly. Two ideas:

    1. Define a lowpass response as a FIR filter, determine its
    coefficients, and walk that filter (envision it as a arc-section of a
    circle) around the input ring, one step at a time. At each step, do
    the multiply-accumulate (convolution) thing and poke the resulting
    value into the output array.

    2. Simulate a single-pole lowpass filter as out = out + (in-out)/K.
    "Connect" it to the input data ring, walk it around one loop to
    "charge it up", then walk around another loop, with the "out" value
    now loading the output loop.

    Lastly, I can normalise the output array to 1 volt RMS, remove any
    residual DC component, and quantize to 16 bits.


    So I can code this without much trouble, and come up with some
    candidate algorithms and coefficients. I can export the data as a csv
    or whatever. What I need is a nice, easy-to-drive frequency analysis
    program, a fun Windows FFT utility. Any suggestions?

    I'm thinking also that my "noise" spectrum will be a bunch of lines,
    not continuous, because my waveform is actually periodic. So we might
    somewhat randomize the DDS input frequency value to smear the lines in
    the frequency domain, jittering the waveform in the time domain. The
    effects of this needs to be analyzed, too, so the datasets may get
    large. Worst case, we could do the experiment all in hardware and use
    a real (classic, sweeping) spectrum analyzer.

    Or maybe we need another algorithm for digitally generating
    bandlimited Gaussian noise. This one does fit our existing ARB
    architecture with minimal damage... we have a pipelined ARB
    architecture that we'd rather not trash much.

    Ideas?

    John
     
  2. Tim Wescott

    Tim Wescott Guest

    The process that you suggest in points 1 and 2 don't require an FFT, yet
    an FFT would be just the thing to use.

    The FFT math is appropriate for a periodic signal, so if you use
    4096-point set of completely random data, do an FFT, band limit it by
    multiplying it point-by-point with your filter envelope, then do an
    IFFT, you'll get perfectly bandlimited but periodic data.

    If you're clever you can eliminate the initial FFT step by generating a
    2048-point set of complex numbers then reflecting it with 2048 complex
    conjugates (except for point 1 and point 2049, which will be all real).
    Then your inverse transform will be real, within the precision of your
    FFT algorithm.

    You can do all of this with Scilab (http://www.scilab.org). It's a
    general-purpose math package like MatLab. Unlike MatLab it's free. The
    user interface is obscure, and the help is dismal, but it's a
    tremendously powerful package

    --

    Tim Wescott
    Wescott Design Services
    http://www.wescottdesign.com

    Posting from Google? See http://cfaj.freeshell.org/google/

    Do you need to implement control loops in software?
    "Applied Control Theory for Embedded Systems" gives you just what it says.
    See details at http://www.wescottdesign.com/actfes/actfes.html
     
  3. Fred Bloggs

    Fred Bloggs Guest

    [...snip...]

    No one is all that concerned with your "thinking." The de facto standard
    for doing this sort of thing for the past 21 years is described in
    Gaussian White-Noise Generation for Digital Signal Synthesis,
    Kafadar,.K, IEEE Trans. Instrumentation and Measurement, Vol. IM-35, No.
    4., Dec. 1986, 492-495. This paper is referenced all over the place and
    the implementation breaks down into about a six line MathCad program to
    produce the sample set.
     
  4. John Larkin

    John Larkin Guest

    I am. My co-workers and employees are. My customers are. Sometimes my
    wife and my kids are. The cats apparently aren't.

    What't the point of having an engineering discussion group if all the
    responses are "go research the IEEE literature."?

    Not being an IEEE member, I don't have access to that paper. Someone,
    like you, could be kind and email me a copy. However references to it
    suggest it doesn't address the details of my problem. Just generating
    a series of bandlimited gaussian signal samples, on a pc, is trivial.

    But it looks as if doing it the easy way, loading a bandlimited
    Gaussian noise waveform into the 4K point arb waveform table, must
    necessarily make bad noise. The spectrum will have discrete lines at
    multiples of Fclk/Table_len, which is nasty, and the max/min noise
    range will be badly limited. It will also be visually periodic, not
    too impressive. Dithering the DDS clock helps a little but has
    problems of its own.

    So we'll probably use a tapped long-pattern pseudorandom shift
    register (64 or 96 bits maybe) and post-scramble to zap bit
    crosscorrelations; XOR gates are free. That gives us random 16-bit
    numbers with flat probability distribution. If we digitally lowpass
    filter that, we'll get bandlimited Gaussian noise. If we clock that
    whole system from the DDS synthesizer, we can set the noise bandwidth
    3db point anywhere we like it, mHz to MHz, without affecting RMS
    amplitude, which is pretty cool.

    Our problem now is to squeeze 8 such noise generators into a Spartan3
    FPGA, most of whose multipliers have already been used in the DDS and
    modulators. The filters look like the tricky part, but I have an Evil
    Scheme for them.

    John
     
  5. John Larkin

    John Larkin Guest

    Oh, ProStat, by Poly Software Int'l, is a nice, easy to drive graphing
    program that has lots of math operations... FFT, correlations, curve
    fits, density functions, lots of nice engineering stuff. It seems to
    be limited to 128K points, not the best for some signal processing
    stuff. A modern PC can do a million point FFT in a reasonable time.

    John
     
  6. Mike Monett

    Mike Monett Guest

    You can't change a flat probability distribution into a Gaussian by low
    pass filtering.

    Filtering has no effect on the probability distibution.

    Regards,

    Mike Monett
     
  7. John Larkin

    John Larkin Guest

    AoE, p 655, first line on the 2nd column. You might also google
    "central limit theorem."

    Are you yet another nym for MassiveProng?

    John
     
  8. Mike Monett

    Mike Monett Guest

    Don't be stupid, John.

    The Central Limit Theorem doesn't talk about the frequency spectrum of
    noise, only about the probability distribution.

    I don't have AoE, John. Please post the relevant section, or some other web
    url.

    Regards,

    Mike Monett
     
  9. John Larkin

    John Larkin Guest

    You don't need a book and you don't need a link; you only have to
    think for about 15 seconds.

    John
     
  10. Marra

    Marra Guest

    There is always a bit of degree snobbery around.

    Thinking is pretty good and a bit of research.
    Dont take anything for granted.
     
  11. Fred Bloggs

    Fred Bloggs Guest

    Sounds like a work around infringement of US6732128...
     
  12. John Larkin

    John Larkin Guest

    Actually, we considered loading the waveform table with random values
    and wobulating the dds phase accumulator input to select table entries
    in a non-trivial pattern. That was one of our many wild ideas in the
    last week. It turns out to put some adders in a time-critical path
    (all this stuff runs at 128 MHz) and got complex anyhow, so we decided
    (as of this afternoon) to ignore the arb memory and generate the noise
    off to the side, with a pseudo-random shift register and some hashing.
    We still need to digitally lowpass filter the data to make it Gaussian
    and define its bandwidth, but that can't be protected by a patent.

    All this is bring us back to the Signals and Systems stuff we studied
    a long time ago, but the math is seriously opaque here. I think we'll
    justify buying a new spectrum analyzer to check how the final thing
    really works. Anybody got a suggestion for a nice one? Several people
    are making portable ones that look like tablet PCs with color LCDs, in
    the 1-3 GHz range, under $10K maybe. Any comments?

    John
     
  13. joseph2k

    joseph2k Guest

    No, John. Mr. Monett easily predates MassivelyWrong. Please do not lump
    him in with the the auktards.
     
  14. John Larkin

    John Larkin Guest

    Well, he did tell me that what we'd been working on all week was
    totally wrong, and that I should scan and send him a chapter from
    Win's book, and hunt down links for him. All without bothering to
    first check to see if he was right. Under those circumstances, I have
    a legal right to be a little crabby.

    John
     
  15. joseph2k

    joseph2k Guest

    OK. I am crabby all the time. I am trying to out crabby Lucy.
     
  16. The Central Limit Theorem.
    Not very difficult to derive it.
    It depends on how well do you want to match the Gaussian distribution. If I
    am not mistaken in my coarse estimates, somewhat 1/30 of the initial
    bandwidth should give a reasonably accurate approximation (better then 1%
    RMS).
    Truly Gaussian source must have infinite peak power.
    The hypocrisy and bs will work as usual.

    Vladimir Vassilevsky
    DSP and Mixed Signal Consultant
    www.abvolt.com
     
  17. John Larkin

    John Larkin Guest

    The generator on page 662 of AoE uses a FIR filter with a cutoff of
    about 1/20 of the clock rate. But he's starting with a 1-bit stream,
    which has a dual-impulse PD, about as bad as it gets. My 16-bit random
    numbers start with a flat PD, which gives me a serious leg up. Summing
    even six samples will result in a pretty good Gaussian distribution.

    The real problem isn't to get a decent Gaussian probability
    distribution; that's easy. The hard part is to get the spectrum right,
    and not fry the FPGA in the process.
    If you sum a finite number of samples, the PD falls to zero on the
    tails, instead of trailing off to infinity. That allows you to get a
    reasonable amount of RMS signal through your amplifier stages. If you
    get crazy and try to generate a true normal distribution, the
    amplifier *will* clip, and the resulting distribution will be a lot
    worse.

    I note here, for any individuals that didn't know it already, that
    lowpass filtering involves summing.

    John
     
  18. John Larkin wrote:

    AoE is a basic cookbook for amateurs and beginners. The recipes from
    there are fairly good, but may not be absolutely best for all occasions.
    And as every cookbook, AoE doesn't go into the depth.
    That makes a lot of sense. For the Gaussian generators of this type, the
    rule of thumb is 12 samples.
    It should not be a problem to generate a reasonably flat gaussian noise
    in a band by the use of FIR filter.

    I note here, for those who don't know, that any filtering involves some
    sort of summing, and the lowpass filtering is not conceptually different
    from bandpass or highpass.



    Vladimir Vassilevsky

    DSP and Mixed Signal Design Consultant

    http://www.abvolt.com
     
  19. JeffM

    JeffM Guest

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-