[Numpy-discussion] fft trouble

Raspaud Martin martin.raspaud at smhi.se
Tue Nov 3 08:39:42 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gabriel wrote:
> Hi it`s my first time.
> 
> I have a trouble whit fft.
> For example:
> s = sin(wt)
> 
> f = abs(fft(s))
> 
> In f I have the module the fft(s) which should be equal to 1 for w but
> it's 1000 for w. All values is multiplied by 1000.
> 
> Someone know why?

Hi,

I don’t know if this is numpy related, but I know a little bit about fft
in general, and it looks like you did not normalize the result.

The documentation does not specify that the resulting array is
normalized, so you should do :

s = sin(wt)
f = abs(fft(s) / len(s))

I guess your wt has a length of 1000 ?

Regards,

Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJK8DKdAAoJEBdvyODiyJI4zCkH/Ahe8dh+zfVK6nTWeaKqjcPy
fqpn2PSvb3l0z+dfOxtmkv9DB24ntJadQ+H26t1VeK5HcZxSunncb8vfGsrWtIZN
Z773aE7ZtZZpIYl+wbIQKCiAQ6gZFUbuK4qJxFl0iLGlQXcGjM4EjqO8nDhKHuOr
hpjhtfp56s35e3rXJFT7Za4XNt17pGnMsk/91/X3/ACCjAJNH1F1KZl7yULZqEUj
KBY62UMWA136xOi2bFKacMW7Ir4qhSVEZnkA0LN2VArAZ4RYV7290dARFZ+N78+V
W4sX4DBPECMZ3vGl7y+mjfMqExk9GDC6hpV8MiVfidMeFhYV5+PgNodE5Ectekg=
=9PY4
-----END PGP SIGNATURE-----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20091103/a519c324/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: martin_raspaud.vcf
Type: text/x-vcard
Size: 260 bytes
Desc: martin_raspaud.vcf
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20091103/a519c324/attachment.vcf>


More information about the NumPy-Discussion mailing list