Skip to content

Instantly share code, notes, and snippets.

@tbhaxor
Created October 30, 2019 18:11
Show Gist options
  • Save tbhaxor/c6d824bdde023be6aa366be7f91c79ab to your computer and use it in GitHub Desktop.
Save tbhaxor/c6d824bdde023be6aa366be7f91c79ab to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "i8NPNsYI5-Xu"
},
"source": [
"# Fourier transform\n",
"It is limitation of Fourier Series, and is corcerned with analysis of non-periodic phenomenons.\n",
"\n",
"### Analysis\n",
"Breaking up of signal into its simpler constituent parts\n",
"\n",
"### Synthesis\n",
"Reassemble a signal from its constituent parts.\n",
"\n",
"Both analysis and synthesis are accomplished by linear operations,i.e., integral(Sum) and series.\n",
"Fourier Analysis is a part of subject of linear system, but it is a vast subject of it's own."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "ETrMEXnF79LM"
},
"source": [
"## Periodic Phenomenon and Fourier Series\n",
"It is the mathematics and engineering of regularly repeating patterns.\n",
"Periodic phenomenon often are either periodic in time.,eg. harmonic motion, pendulum.\n",
"or Periodic in space - Physical quantity distributed over a region with symmetry.Periodicty arises from symmetry. e.g. Distribution of heat on circular ring."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "4o3V8RwC9dFK"
},
"source": [
"Often we see Fourier analysis is often associated with problem with symmetry.\n",
"\n",
"### Mathematics\n",
"The quantity you associate for periodicity in time is frequency.The no. of cycles per second. Number of repetion of patterns over time.\n",
"\n",
"For a phenomenon peridoic in space we use period. How big the pattern is before it repeats.\n",
"\n",
"Two notions of periodicity come together in wave motion. A regularly moving disturbance.A frequency($\\nu$)- cycle per second and wavelength.\n",
"\n",
"For perodicity in space fix the time and see how wave is distributed in space. The length of one complete pattern of disturbance is called wavelength($\\lambda$).\n",
"\n",
"Relationship between frequency and wavelength is , distance = rate*time.\n",
"\n",
"Rate is velocity.\n",
"$v = \\nu \\lambda$.\n",
"There is a reciprocal relationship between frequency anad wavelength.\n",
"\n",
"Math comes in because there are simple mathematical functions that repeate so can be used to model periodic phenomenon."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "MgREzWaPB90b"
},
"source": [
"$Cos(t)$ and $sin(t)$ are periodic in 2$\\pi$.\n",
"\n",
"Because $sin$ and $cosin$ are periodic in space. \n",
"\n",
"Consider a circle and a co-ordinate in circe are $(cos(t),sin(t))$.\n",
"\n",
"$cos(t+2\\pi)=cos(t )$ for all $(1,2,3...)$\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "xg2hIEk5Dg0b"
},
"source": [
"how can we use simple functions to make complex periodic phenomenon.\n",
"\n",
"How far can we aim?\n",
"\n",
"Not all phenomenons are periodic, many are periodic in time but die out eventually but periodic functions $sine$ and $cosine$ repeat forever. \n",
"\n",
"You still apply ideas of periodicity.\n",
"\n",
"Suppose the signal looks like dying out after a time interval. You can repeat the pattern and make it periodic ,i.e. ,force periodicity.\n",
"\n",
"This is called Periodization of the signal."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "aIE5_P0dFVtP"
},
"source": [
"Lets fix problem for discussion - period is 1.\n",
"\n",
"We consider function $f(t)=f(t+1)$ for all $t$.\n",
"\n",
"Model signals are $sin(2\\pi t)$ and $cos(2\\pi t)$.\n",
"\n",
"If we \"know\" a periodic function period 1 on an interval of length 1. We \"know\" it everywhere.\n",
"\n",
"We can modify and combine $sin(2\\pi t)$ and $cos(2\\pi t)$ to model general periodic signal of period 1.\n",
"\n",
"**The big idea is one period, many frquencies.**\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "vPStHiJpIQfB"
},
"source": [
"To model a complicated signal of period t, we can modify the amplitude, frequency and phases of $sin(2\\pi t)$ and sum the results.\n",
"\n",
"$\\displaystyle\\sum_{k=1}^NA_ksin(2\\pi kt+\\phi_k)$\n",
"\n",
"Whole sum always has period 1 because pattern cannot repeat until the shortest pattern repeats.\n",
"\n",
"$A_ksin(2\\pi kt+\\phi_k) = sin(2\\pi kt)cos(\\phi_k)+ cos(2\\pi kt)sin(\\phi_k)$\n",
"\n",
"$\\displaystyle\\sum_{k=1}^N(a_ksin(2\\pi kt)+ b_kcos(2\\pi kt))$\n",
"\n",
"We can add a constant term,\n",
"\n",
"$\\frac{a_0}{2}+\\displaystyle\\sum_{k=1}^N(a_ksin(2\\pi kt)+ b_kcos(2\\pi kt))$\n",
"\n",
"By far better to use to represent $sin$ and $cosine$ via complex exponentials:\n",
"\n",
"$e^{2\\pi ikt} = cos(2\\pi kt) + isin(2\\pi kt)$ **here** $i=\\sqrt{-1}$\n",
"\n",
"**Real part** - $cos(2\\pi kt) = \\frac{e^{2\\pi ikt}+e^{-2\\pi ikt}}{2} $\n",
"\n",
"**Imaginary Part**- $sin(2\\pi kt) = \\frac{e^{2\\pi ikt}-e^{-2\\pi ikt}}{2i} $\n",
"\n",
"We can convert a trignometric sum as before to the sum of complex exponents:\n",
"\n",
"$\\displaystyle\\sum_{k=-n}^n c_ke^{2\\pi ikt}$\n",
"\n",
"The $c_k$ are complex numbers\n",
"\n",
"The complex number satisfy symmerty property so the sum is real.\n",
"\n",
"$c_{-k} = \\bar{c_k}$\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "jb1WaE8QTHsf"
},
"source": [
"Can number ask the fundamental question:\n",
"\n",
"f(t) has period 1.\n",
"Can we write it as:\n",
"\n",
"$f(t) = \\displaystyle\\sum_{k=-n}^n c_ke^{2\\pi ikt}$\n",
"\n",
"Suppose we can write , what has to happen then?\n",
"\n",
"What are the coefficients $c_k$ in terms of $f(t)$.\n",
"\n",
"Let's isolate it.\n",
"\n",
"$f(t) = \\cdots+c_me^{2\\pi imt}+\\cdots$\n",
"\n",
"$c_me^{2\\pi imt} = f(t)-\\displaystyle\\sum_{k!=m} c_ke^{2\\pi ikt}$\n",
"\n",
"Multiplying each side by $e^{-2\\pi imt}$\n",
"\n",
"$c_m = e^{-2\\pi imt}f(t)-\\displaystyle\\sum_{k!=m} c_ke^{2\\pi ikt}e^{-2\\pi imt}$\n",
"\n",
"\n",
"$c_m = e^{-2\\pi imt}f(t)-\\displaystyle\\sum_{k!=m} c_ke^{2\\pi i(k-m)t}$\n",
"\n",
"Lets integrate for a period 1.\n",
"\n",
"$\\displaystyle\\int\\limits_0^1 c_mdt = c_m$\n",
"\n",
"$\\displaystyle\\int\\limits_0^1 e^{-2\\pi imt}f(t)dt + \\sum_{k!=m} c_k\\displaystyle\\int\\limits_0^1 e^{2\\pi i(k-m)t}dt$\n",
"\n",
"$\\displaystyle\\int\\limits_0^1 e^{-2\\pi i(k-m)t} = \\left.\\frac{1}{2\\pi i(k-m)} e^{-2\\pi i(k-m)t}\\right|_0^1$\n",
"\n",
"$\\displaystyle\\int\\limits_0^1 e^{-2\\pi i(k-m)t} = \\frac{1}{2\\pi i(k-m)} \\left[e^{-2\\pi i(k-m)}-e^0\\right]$\n",
"\n",
"$e^{-2\\pi i(k-m)} = e^{-2\\pi in} = 1,$ where n is an integer.\n",
"\n",
"$\\displaystyle\\int\\limits_0^1 e^{-2\\pi i(k-m)t}=0$\n",
"\n",
"So,\n",
"\n",
"$c_m=\\displaystyle\\int\\limits_0^1 e^{-2\\pi imt}f(t)dt$"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "Et4bo40Rk885"
},
"source": [
"Suppose we can write,\n",
"\n",
"$f(t) = \\displaystyle\\sum_{k=-n}^n c_ke^{2\\pi ikt}$\n",
"\n",
"Then you must have $m_{th}$ coefficient as:\n",
"\n",
"$c_m=\\displaystyle\\int\\limits_0^1 e^{-2\\pi imt}f(t)dt$"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "eADQJcsMle3U"
},
"source": [
"We first took them in analysing general periodic phenomenon via linear combination of simple periodic phenomenon.\n",
"\n",
"Now we will turn this around $f(t)$ has period 1.\n",
"\n",
"$\\hat f(k)=\\displaystyle\\int\\limits_0^1 e^{-2\\pi imt}f(t)dt$\n",
"\n",
"where $\\hat f(k)$ is the $k_{th}$ fourier coefficient of $f(t)$.\n",
"\n",
"Can we write:\n",
"\n",
"$ f(t)=\\displaystyle\\int\\limits_0^1 e^{2\\pi imt}\\hat f(t)dt$\n",
"\n",
"This is the same question asked previously.\n",
"\n",
"If so, we can analyse complex system via simple building blocks. How general can we expect it to be if this works?\n",
"\n",
"**High Stake Questions**\n",
"\n",
"1. Switch On for 1/2 second and OFF for 1/2 second.\n",
"\n",
"We can find its coefficient by-\n",
"\n",
"$\\hat f(k)=\\displaystyle\\int\\limits_0^{\\frac{1}{2}} e^{-2\\pi imt}dt+ 0$\n",
"\n",
"Can we write:\n",
"\n",
"$f(t) = \\displaystyle\\sum_{k=-n}^n \\hat f(k)e^{2\\pi ikt}$\n",
"\n",
"Answer is no, not for finite sum.\n",
"\n",
"Because $sin$ and $cosine$ are continuous phenomenon. So you cannot represent their sum as discontinuous phenomenon.\n",
"\n",
"What about traingular function of period 1. We can obviously find its fourier coefficient. But can we represent it in form of:\n",
"\n",
"$f(t) = \\displaystyle\\sum_{k=-n}^n \\hat f(k)e^{2\\pi ikt}$\n",
"\n",
"Answer again is no. Because $sin$ and $cosine$ are differentiable phenomenon. So you cannot represent their sum in non-differentiable phenomenon.\n",
"\n",
"That means any discontunity of any derivative is not allowed. since cos and sin are infinitely diffrentiable. \n",
"\n",
"**Maxim**- is it takes high frequencies to make sharp corner.\n",
"\n",
"To represent the general periodic signals we have to consider infinte sums. But the infinte sums can not be calculted but approximated. So they should converge.\n",
"\n",
"\n",
"Must consider:\n",
"\n",
"$f(t) = \\displaystyle\\sum_{k=-\\infty}^\\infty \\hat f(k)e^{2\\pi ikt}$\n",
"\n",
"Any non-smooth signal will generate infinitely many fourier coefficient.\n",
"\n",
"we have to deal with issue of convergence. We need a conspiracy of cancelleation. ,i.e, somethings have to cancel each other because of oscilations.\n",
"\n",
"Summary of the main result- \n",
"\n",
"Convergence when the function is continuous. Convergence when the function is smooth. Convergence when certain discontunities. Convergence for jump discontunities. \n",
"\n",
"Convergence in general- this needs fundamental change of prspective.\n",
"\n",
"**Continuous case** - \n",
"$f(t) = \\displaystyle\\sum_{k=-\\infty}^\\infty \\hat f(k)e^{2\\pi ikt}$\n",
"\n",
"converges for each t for f(t).\n",
"\n",
"**Smooth Case**- \n",
"[latex]f(t) = \\displaystyle\\sum_{k=-\\infty}^\\infty \\hat f(k)e^{2\\pi ikt}[/latex]\n",
"\n",
"converges for each t for f(t).\n",
"For this we get uniform rate of convergence,i.e, control rate of convergence.\n",
"At differnet values of t depending on the degree of smoothness.\n",
"\n",
"**Jump Discontunity**- \n",
",i.e., ON and OFF signal.\n",
"\n",
"If $t_0$ is a point of jump discontunity,\n",
"$f(t) = \\displaystyle\\sum_{k=-\\infty}^\\infty \\hat f(k)e^{2\\pi ikt}$\n",
"\n",
"The function converges at $t_0$.\n",
"\n",
"$\\frac{1}{2}\\left[f(t_0^)+f(t_0^-) \\right]$\n",
"\n",
"**General Case**-\n",
"\n",
"We learned by hard lessons ,a diffent notion of convergence. Not to ask a convergence of -\n",
"$f(t) = \\displaystyle\\sum_{k=-\\infty}^\\infty \\hat f(k)e^{2\\pi ikt}$\n",
" \n",
"at particualr points. sqatifying picture if ask for converge in the mean, i.e., on an average sense.\n",
"\n",
"Suppose f(t) is peiodic with period 1. \n",
"\n",
"Suppose $\\int\\limits_{0}^{1} \\left|f(t)\\right|^2dt < \\infty$\n",
"\n",
"this is also called Finite Energy.\n",
"\n",
"Then it can form \n",
"$f(t) = \\displaystyle\\sum_{k=-\\infty}^\\infty \\hat f(k)e^{2\\pi ikt}$\n",
"\n",
"Then, \n",
"\n",
"$\\displaystyle\\int\\limits_{0}^{1} \\left|\\sum_{k=-n}^n \\hat f(k)e^{2\\pi ikt}- f(t)\\right|^2dt \\to 0$ as $n \\to \\infty$\n",
"\n",
"This represents series converges in the average sense, in the means sense not at every point.\n",
"\n",
"This implies, if we take it equal to 0\n",
"\n",
"$\\displaystyle f(t) = \\sum_{k=-\\infty}^\\infty \\hat f(k)e^{2\\pi ikt}$\n",
"\n",
"This equal sign does not mean literally that plug value of t and and series will converge for function. It means that if we compute the integral to finite sum and let degree go to infinity then mean square differnece will tend to 0.\n",
"\n",
"This notion of equality had far reaching consequences.\n",
"\n",
"Hope to see you in next blog.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"name": "Fourier Transform.ipynb",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment