Skip to main content

Posts

Showing posts with the label fourier

Fourier Transform - Basics - Example

 U might wonder how fft is performed using python or any using any language the concept here is to explain the fft in detail with example u can run the code in python using colab or copy the code below to run in your local m/c. Consider a sample of data  that  has N data points against time the fft for the data points will give you the amplitude for the data points which could a  complex number  again what is a complex number (a+ib) i*i = -1 again why this complexity don't worry too much we will talk about this in detail. consider  a - to be the x axis (real) ib - y axis (Imaginary) still confused with the formula don't worry we will work a sample for f(0) so now we have seen the computation for f(0) in the same way calculate till f(N-1) ,run the code below to cross check the values.  result - f(0) = (-1.1102230246251565e-16+0j) f(1) = (5.551115123125783e-16-3.9996979771955568j) f(2) = (-1.410503594010501e-16+2.220446049250313e-16j) f(3)= 0.00030202280444291407j f(4) = 2.028015

Fourier Transform - FFT

  so what is FFT or the fourier transform. what is the use of the transform ok an example would be a couple of data points in a digital world and you want to  transform the data. so why we need to transform the data  consider a couple of digital data for sound wave and you want to do some manipulation on the data ,sine it resembles a sine wave  we plot the data points as a sin wave    your x axis would be time  y axis would be your data  The theory here is sound wave has a mix of signals so sin wave of  different frequencies ,since we have collected data over time we have to transform time data to freq data   in the freq domain our x axis would be angular frequency  y axis would be amplitude.     you can find the link for the FFT and inverse FFT for  a sin wave      https://github.com/naveez-alagarsamy/matplotlib/blob/main/fourier.ipynb   if u cant acess the link use the below code to run locally   import matplotlib.pyplot as plt import numpy as np from numpy.fft import fft