Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
NumPy Essentials

You're reading from  NumPy Essentials

Product type Book
Published in Apr 2016
Publisher
ISBN-13 9781784393670
Pages 156 pages
Edition 1st Edition
Languages
Authors (3):
Leo (Liang-Huan) Chin Leo (Liang-Huan) Chin
Profile icon Leo (Liang-Huan) Chin
Tanmay Dutta Tanmay Dutta
Profile icon Tanmay Dutta
Shane Holloway Shane Holloway
Profile icon Shane Holloway
View More author details

Table of Contents (16) Chapters

NumPy Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
An Introduction to NumPy The NumPy ndarray Object Using NumPy Arrays NumPy Core and Libs Submodules Linear Algebra in NumPy Fourier Analysis in NumPy Building and Distributing NumPy Code Speeding Up NumPy with Cython Introduction to the NumPy C-API Further Reading

Fourier analysis


There are many ways to define the DFT; however, in a NumPy implementation, the DFT is defined as the following equation:

A k represents the discrete Fourier transform and am represents the original function. The transformation from am->Ak is a translation from the configuration space to the frequency space. Let's calculate this equation manually to get a better understanding of the transformation process. We will use a random signal with 500 values:

In [25]: x = np.random.random(500) 
In [26]: n = len(x) 
In [27]: m = np.arange(n) 
In [28]: k = m.reshape((n, 1)) 
In [29]: M = np.exp(-2j * np.pi * k * m / n) 
In [30]: y = np.dot(M, x) 

In this code block, x is our simulated random signal, which contain 500 values and corresponds to am in the equation. Based on the size of x, we calculate the sum product of:

We then save it to M. The final step is to use the matrix multiplication between M and x to generate DFT and save it to y.

Let's...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}