[Numpy-discussion] fft trouble

Raspaud Martin martin.raspaud@smhi...
Tue Nov 3 07:39:42 CST 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.scipy.org/pipermail/numpy-discussion/attachments/20091103/a519c324/attachment-0001.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.scipy.org/pipermail/numpy-discussion/attachments/20091103/a519c324/attachment-0001.vcf 


More information about the NumPy-Discussion mailing list