Thursday, April 10, 2008

Trying to be modular



After a long hiatus, got FFTW and PGPLOT working in harmony (at last!). Also, I'm starting to see the importance of modularity, and trying to document my code properly.

As of now, I have two cast-iron functions
i) One which takes 512 samples from a file on the hard drive, and returns their autocorrelation as an array of 1023 elements. (Note: The autocorrelation is just for convenience, the same procedure can be used for cross-correlation)

ii) One which takes the array returned by i), transforms it with FFTW, and gives magnitude and phase plots from the FFT.

I'm attaching some screenshots from the results obtained. The phase plots probably require some critical examination..

What to do next:-

Put i) and ii) in a loop on index M, where M is the number of frames to be superimposed.
Also, add some phase to the phase plots to correct for phase difference due to the baseline.

No comments: