matlab and NR (C) FFT routines

revyakin_at_yahoo.com
Date: 03/29/05

  • Next message: Poul Freeman: "Re: 32bit/64bit cpu's and significant figures?"
    Date: 28 Mar 2005 18:16:20 -0800
    
    

    Hi all,

    I did search on this subject in the group, but it's still not working.

    Say, I want to do an fft of this array (actually, copied from a 8-year
    old post).

    [1+2*i 2+3*i 3+4*i 4+5*i]

    When I do fft(data) in Matlab, I get:
    10.0000+14.0000i -4.0000 -2.0000-2.0000i 0-4.0000i.

    When I do the NR's four1() routine, i do it like this
    float data[8] = {1,2,2,3,3,4,4,5};
    four1(data-1, 4, -1);
    ..taking into account the -1 shift in indexing and the -1 for forward
    fft convention. I get:
    -107374176.000000
    10.000000
    14.000000
    -2.000000
    0.000000
    -4.000000
    -4.000000
    0.000000

    Some values (actually belonging to different complex ##) are shifted,
    the one element appears lost, and there is a nonsense number
    -107374176.000000. I have a limited training in math analysis, so I am
    confused here.


  • Next message: Poul Freeman: "Re: 32bit/64bit cpu's and significant figures?"

    Relevant Pages

    • Re: Fundamental frequency -- limited resources
      ... Memory is the biggest ... > constraint, the processor horsepower is not as big a constraint. ... > The reality is that the array will actually hold values like ....4200, ... > keep thinking, "if I could just do an FFT and take the dominant freq, ...
      (sci.math.num-analysis)
    • Re: Imaginary values non-null in FFTW Java wrapper real transform
      ... the format of the array returned by the FFTW real to ... An FFT of a totally real input signal will, in general, return results with nonzero real and imaginary parts. ... If the input signal has even symmetry around 0 then the FFT should be all real, ... Wescott Design Services ...
      (comp.dsp)
    • Fundamental frequency -- limited resources
      ... every 100th sample would be non-zero, ... So if I had an array of 50,000 elements, which would represent 5 ... PC, etc...), an FFT could be used on a huge array of time-domain ... samples, and the fundamental frequency of 100 would come through, is ...
      (sci.math.num-analysis)
    • Re: Something astray in my FFT understanding
      ... What my routine does is it accepts an array of N points. ... FFT being real, it accepts one array of real, not complex, numbers, each ... An N-point DFT produces N complex-valued coefficients, ...
      (comp.dsp)
    • Re: Fundamental frequency -- limited resources
      ... Why is a median filter not good enough? ... your sorted array. ... > constraint, the processor horsepower is not as big a constraint. ... > keep thinking, "if I could just do an FFT and take the dominant freq, ...
      (sci.math.num-analysis)