Analysis of Fourier series using Python Code
Analysis of Fourier series using Python Code
Dr. Shyamal Bhar Department of Physics Vidyasagar College for Women
Kolkata ? 700 006
We know that there are many ways by which any complicated function may be expressed as power series. This is not the only way in which a function may be expressed as a series but there is a method of expressing a periodic function as an infinite sum of sine and cosine functions. This representation is known as Fourier series. The computation and study of Fourier series is known as harmonic analysis and is useful as a way to break up an arbitrary periodic function into a set of simple harmonic terms that can be plugged in, solved individually, and then recombined to obtain the solution to the original problem or an approximation to it to whatever accuracy is desired. Unlike Taylor series, a Fourier series can describe functions that are not everywhere continuous and/or differentiable. There are other advantages of using trigonometric terms. They are easy to differentiate and integrate and each term contain only one characteristic frequency. Analysis of Fourier series becomes important because this method is used to represent the response of a system to a periodic input and the response depends on the frequency content of the input.
Dirichlet Conditions: The conditions that a function f x may be expressed as Fourier series are
known as the Dirichlet conditions. The conditions are i) The function must be periodic ii) It must be single valued and continuous. There may a finite number of finite discontinuities iii) It must have only a finite number of maxima and minima within one period
iv) The integral over one period of f x must converge.
Fourier series makes of the orthogonality relationships of the sine and cosine functions. The integral over one period of the product of any two terms have the following properties:
Dr. Shyamal Bhar, Department of Physics, Vidyasagar College for Women, Kolkata ? 700 006 1
x0 L
x0
sin
2 nx L
cos
2 mx L
dx
0
for
all
m
and
n
L for m n 0
x0
x0
L
cos
2 nx L
cos
2 mx L
dx
L 2
for
m
n
0
0 for m n
L for m n 0
x0
L
sin
x0
2 nx L
sin
2 mx L
dx
L 2
for
m
n
0
0 for m n
So the Fourier series of the function f x over the periodic interval 0, L is written as
f
x
a0 2
n1
an
cos
2 nx L
bn
sin
2 nx L
where an and bn are constants called the Fourier coefficients and
a 0
2 L
L 0
f
xdx
an
2 L
L 0
f
x
cos
2 nx L
dx
bn
2 L
L 0
f
x
sin
2 nx L
dx
The Fourier series of the function f x over the periodic interval L, L is written as
f
x
a0 2
n 1
an
cos
nx L
bn
sin
nx L
where,
Dr. Shyamal Bhar, Department of Physics, Vidyasagar College for Women, Kolkata ? 700 006 2
a 0
1 L
L L
f
xdx
an
1 L
L L
f
x
cos
nx L
dx
bn
1 L
L L
f
x
sin
nx L
dx
The Fourier series of the function f x over the periodic interval , is written as
f
x
a0 2
n 1
an
cos nx bn
sin nx
where,
a 0
1
f
xdx
an
1
f
x cosnx dx
bn
1
f
xsin nx dx
built-in piecewise continuous functions such as square wave, sawtooth wave and triangular wave
1. scipy.signal.square module
scipy.signal.square (x, duty=0.5)
Return a periodic square-wave waveform.
The square wave has a period 2*pi, has value +1 from 0 to 2*pi*duty and -1 from 2*pi*duty to 2*pi. duty must be in the interval [0,1].
Dr. Shyamal Bhar, Department of Physics, Vidyasagar College for Women, Kolkata ? 700 006 3
2. scipy.signal.sawtooth module
scipy.signal.sawtooth(x, width=1) Return a periodic sawtooth or triangle waveform. The sawtooth waveform has a period 2*pi, rises from -1 to 1 on the interval 0 to width*2*pi, then drops from 1 to -1 on the interval width*2*pi to 2*pi. width must be in the interval [0, 1].
Triangular wave from sawtooth signal
Dr. Shyamal Bhar, Department of Physics, Vidyasagar College for Women, Kolkata ? 700 006 4
3. Scipy.signal.triang () module scipy.signal.triang(M, sym=True) Return a triangular window. w : ndarray The window, with the maximum value normalized to 1 (though the value 1 does not appear if M is even and sym is True).
Example -1 # Fourier series analysis for a sqaure wave function # user defined function import numpy as np from scipy.signal import square import matplotlib.pyplot as plt from scipy.integrate import simps
Dr. Shyamal Bhar, Department of Physics, Vidyasagar College for Women, Kolkata ? 700 006 5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- let s try some random projections of the data
- python tracer des graphiques avec matplotlib
- chapter plotting data using 4 matplotlib
- matplotlib 2d and 3d plotting in python
- python machine learning
- python data science handbook
- cme193 introductiontoscientificpython lecture5 numpy
- analysis of fourier series using python code
- matplotlib tutorialspoint
- केंद्रmय विद्यालय संगठन क्षेत्रmय कायाालय रायपnर
Related searches
- using python in bash
- using python on windows 10
- sum of squared error using python functions
- fibonacci series using recursion c
- using c code in unity
- install jupyter using python 3 8
- using python functions
- using python as a calculator
- using python in cmd
- using python in linux
- using python in command line
- using python with html