- Related Questions & Answers
- C++ Program to Compute Discrete Fourier Transform Using Naive Approach
- Discrete time and Z transform
- Explain how Nelder-Mead algorithm can be implemented using SciPy Python?
- What is SciPy in Python? Explain how it can be installed, and its applications?
- How can SciPy be used to calculate the inverse of a matrix in Python?
- How can SciPy be used to calculate the permutations and combination values in Python?
- Explain how the minimum of a scalar function can be found in SciPy using Python?
- How can SciPy be used to calculate the determinant value of a matrix in Python?
- How can SciPy be used to calculate the cube root of values and exponential values in Python?
- C++ Program to Check Whether Topological Sorting can be Performed in a Graph
- How can SciPy be used to calculate the eigen values and eigen vectors of a matrix in Python?
- What kind of string comparison, case-sensitive or not, can be performed by MySQL?
- Check if the given array can be reduced to zeros with the given operation performed given number of times in Python
- Discrete Mathematics Relations
- How can ‘implot’ function be used to fit values to data if one of the variables is a discrete value in Python?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Discrete Fourier Transform, or DFT is a mathematical technique that helps in the conversion of spatial data into frequency data.

Fast Fourier Transformation, or FTT is an algorithm that has been designed to compute the Discrete Fourier Transformation of spatial data.

The spatial data is usually in the form of a multidimensional array. Frequency data refers to data that contains information about the number of signals or wavelengths in a specific period of time.

Let us see how this DFT can be achieved using the ‘SciPy’ library.

The graph is created using the matplotlib library and data is generated using the Numpy library −

From matplotlib import pyplot as plt import numpy as np my_freq = 6 freq_samp = 70 time_val = np.linspace(0, 3, 3 * freq_samp, endpoint = False ) amp_val = np.sin(my_freq * 3 * np.pi * time_val) figure, axis = plt.subplots() axis.plot(time_val, amp_val) axis.set_xlabel ('Time (in seconds)') axis.set_ylabel ('Amplitude of signal') plt.show() from scipy import fftpack A = fftpack.fft(amp_val) frequency = fftpack.fftfreq(len(amp_val)) * freq_samp figure, axis = plt.subplots() axis.stem(frequency, np.abs(A)) axis.set_xlabel('Frequency in Hz') axis.set_ylabel('Frequency Spectrum Magnitude') axis.set_xlim(-freq_samp / 2, freq_samp/ 2) axis.set_ylim(-7, 125) plt.show()

- The required packages are imported.
- The data is generated with the help of Numpy library.
- This data is plotted as a sine wave on the console with the help of matplotlib library.
- Next, the ‘fftpack’ package is used to find the fast Fourier transform of the data generated.
- This data is again plotted on the graph.

Advertisements