International Journal of Electrical, Electronics and Computer Systems (IJEECS)
________________________________________________________________________________________________
________________________________________________________________________________________________
ISSN (Online): 2347-2820, Volume -4, Issue-3, 2016 19
Spectral Analysis of Fourier Series Using Scilab
Prakash Uttam Sansare, Shantaram M. Raul
Department of Mathematics Birla College, Kalyan 421 301, Maharashtra Abstract—In this paper we will explore the Error Analysis
of Fourier series for periodic function using the mathematical software Scilab called as Science Laboratory.
We will also analyse and plot, how geometrically error decreases if we increase the number of terms in partial sum. Finally we will be presenting a table which demonstrate the number of terms in partial sum and error occurred. This process of error analysis in Fourier series is called as Spectral Analysis.
Keywords—Scilab,Periodicfunction,Fourierseries,Error Analysis
I. INTRODUCTION (HEADING 1)
Definition: Even Function
A real valued function f ∶ D → ℝis said to be even functionif
f −x = f x ∀x ∈ D Definition: Periodic Function A real valued function
f ∶ D → ℝ
is said to be periodic function with period T ∈ ℝ if and only if
f x + T = f x ∀ x ∈ D.
Definition: Piecewise Continuous
A function f is said to be piecewise continuous on an interval a ≤ x ≤ b if the interval can be partitioned by a finite number of points
a = x0< x1< x2< ⋯ < xn= bsuch that
1) fis continuous on each open
subinterval xk−1, xk ∀ k = 1 to n
2) fApproachesa finite limit as the endpoints of eachsubinterval are approached from within the subinterval.
Definition: Fourier series.
If f & f′ are piecewise continuous on the interval (c, c + 2l) , further suppose that f is defined outside the interval (c, c + 2l) so that it is periodic with period 2l then f has a Fourier series
f x ≈ a0
2 + ancos n πx
l + bnsin nπx l
∞
n=1
Where a0, an&bn are given by the formulae’s a0=1
l c+2lf x dx
c
;
an =1
l f x cos n πx l dx
c+2l c
;
bn= 1
l f x sin n πx l dx
c+2l
c
The Fourier series convergence to f(x) at all the points where f is continuous and converges to f x+ + f x−
2 if f is discontinuous at x.
II EASE OF USE
Now, consider the following problem f x = 1 + x, −1 ≤ x ≤ 0
1 − x, 0 ≤ x ≤ 1
& f x + 2 = f(x) Since f −x = f x ∀ x ∈ −1,1 ⇒ f
is even function. Also it is periodic with period 2 . (Fig. 1) Further it is piecewise continuous on −1,1
Fig. 1 Graph of 𝐟(𝐱)
International Journal of Electrical, Electronics and Computer Systems (IJEECS)
________________________________________________________________________________________________
________________________________________________________________________________________________
ISSN (Online): 2347-2820, Volume -4, Issue-3, 2016 20
Now we will find out the Fourier expansion of above even function on domain −1,1
a0=1
l c+2lf x
c
=1
1 f x dx = 2 1 − x dx
1
0
1
−1
= 2 x −x2 2 x=0
x=1
= 1 And
an=1
l f x cos nπx l dx
c+2l
c
=1
1 f x cos nπx dx
1
−1
= 2
1 f x cos nπx dx1
0
= 2
1 1 − x cos nπx dx
1 0
= 2 1 − x sin nπx
nπ −cos nπx n2π2 x=0
x=1
=2 1 − −1 n
n2π2 ∀ n ∈ ℕ
= 4
n2π2, if n is odd 0, if n is even
& bn = 0
Hence the Fourier series for above problem is f x ≈ a0
2 + ancos n πx
l + bnsin nπx l
∞
n=1
≈ 1 2+ 4
π2
1
2n − 1 2cos 2n − 1 πx … … (1)
∞
n=1
Error Analysis
Now we will investigate the speed with which series is converges. In particular we will determine how many terms are needed so that the error is no greater that 0.001.
The nthpartial sum of (1) is given by sn x =1
2+ 4 π2
1
2k − 1 2cos 2k − 1 πx
n
k=1
The coefficient diminished as 2n − 1 −2so the series converges fairly rapidly.To investigate convergence in more detail, we can consider the error en x = f x − sn x .
Figure 2 shows the a plot of |e6(x)| versus x for x ∈ −1, 1
Fig.2 Plot of |e6(x)| versus x for x ∈ −1, 1
It is very clear from the fig. 2 ,|e6 x | is greatest at the point x = −1 & x = 1 where the graph of f(x) has the corners. It is more difficult for the series to approximate the function near these points, resulting in a large error there for a given n = 6. Similar graphs are obtained for other values of n.
We can obtain a uniform error bound for each n simply by evaluation |en x | at one of these points. From the above information we will estimate the number of terms that are needed in the series in order to achieve a given level of accuracy in the approximation. For example to guarantee that en x ≤ 0.001 we need to choosen = 128
Value of the error 𝐞𝐧 𝟏 for the triangular wave
𝐧 𝐞𝐧 𝟏
2 0.0496836
4 0.0252011
8 0.0126487
16 0.0063305
32 0.0031660
64 0.0015831
128 0.0007916
TABLE 1. Value of the error 𝐞𝐧 𝟏
International Journal of Electrical, Electronics and Computer Systems (IJEECS)
________________________________________________________________________________________________
________________________________________________________________________________________________
ISSN (Online): 2347-2820, Volume -4, Issue-3, 2016 21
Fig. 3 Plot of n versus 𝐞𝐧 𝟏
III. CONCLUSION:
Fourier series has tremendous application in signal processing & Control theory one can use this spectral analysis technique for better accuracy. The tool Scilab is open software and easy for calculation& plotting of difficult functions in mathematics.
REFERENCES
[1] William E.Boyce & Richard C.Diprima , Elementary Differential Equation and boundary value problems, Wiley;6 edition
[2] Richard R. Goldberg , Method of Real Analysis, Oxford and IBH Publishing 1970.
[3] Robert G. Bartle & Donald R. Sherbart , Introduction to Real Analysis Wiley India, 4edition .
[4] www.scilab.org