# [Numpy-discussion] Spectral approximation/DFT

Magnus Lie Hetland magnus at hetland.org
Thu Jul 25 12:12:11 CDT 2002

```Hi!

Sorry to ask what is probably a really clueless question -- if there
are any obvious sources of information about this, I'd be happy to go
there and find this out for myself... :]

Anyway; I'm trying to produce a graph to illustrate a time sequence
indexing method, which relies on extracting the low-frequent Fourier
coefficients and indexing a vector consisting of those. The graph
should contain the original time sequence, and one reconstructed from
the Fourier coefficients. Since it is reconstructed from only the
low-frequent coefficients (perhaps 10-20 coefficients), it will look
wavy and sinus'y.

Now... I'm no expert in signal processing (or the specifics of FFT/DFT
etc.), and I can't seem to make the FFT module do exactly what I want
here...

It seems that using fft(seq).real extracts the coefficients I'm after
(though I'm not sure whether the imaginary components ought to figure
in the equation somehow...)

But no matter how I use inverse_fft or inverse_real_fft it seems I
have to supply a number of coefficients equal to the sequence I want
to approximate -- otherwise there will be a huge offset between them.
Why is this so? Shouldn't the first coefficient take care of such an
offset? Perhaps inverse_fft isn't doing what I think it is?

If I haven't expressed myself clearly, I'd be happy to elaborate...

(For those who might be interested, the approach is described in the
paper found at http://citeseer.nj.nec.com/307308.html with a figure of
the type I'm trying to produce at page 5.)

Anyway, thanks for any help :)

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org

```

More information about the Numpy-discussion mailing list