0% found this document useful (0 votes)
69 views2 pages

Fourier Series Assignment

This document discusses Fourier series approximations of periodic signals. It provides an example of a two-part periodic signal defined over one period and calculates its Fourier series coefficients. Plots are generated to approximate the signal using an increasing number of Fourier terms and verify the accuracy of the approximation over multiple periods.

Uploaded by

HaroonRashid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views2 pages

Fourier Series Assignment

This document discusses Fourier series approximations of periodic signals. It provides an example of a two-part periodic signal defined over one period and calculates its Fourier series coefficients. Plots are generated to approximate the signal using an increasing number of Fourier terms and verify the accuracy of the approximation over multiple periods.

Uploaded by

HaroonRashid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

5.

7 Fourier Series of Periodic Signals


In the previous sections, the Fourier series expansion of a signal was defined in a closed
time interval [t0, t0 þ T]. Beyond this interval, the Fourier series expansion does not always
converge to the original signal x (t). In this section, we introduce the case where the signal
x (t) is a periodic signal with period T, i.e., x (t) ¼ x (t þ T). In this case, the Fourier series is
also
Fourier periodic withassignment
Series period T; thus it converges to x (t) for #1 < t < 1.
266 Signals and Systems Laboratory with MATLAB1
Example
Approximate, using the complex form of Fourier series, the periodic signal that in one period is
Approximate, using the three forms of Fourier series, the periodic signal that in one period
given by: by
is given
First, the signal x(t) is plotted over the time of five periods for reference reasons.
266 Signals!and Systems Laboratory with MATLAB1
1, 0$t$1
Commands x (t) ¼ :
Results=Comments
#1, 1$t$2
The signal x(t) in five periods.
First, the signal x(t) is plotted over the time of five periods for reference reasons.
1
0.8
First, the
t1 ¼signal x(t) is plotted over the 0.6
0:.01:1; time of five periods for reference reasons.
Commands
t2 ¼ 1.01:.01:2; Results=Comments
x1 ¼ ones(size(t1)); 0.4
The signal x(t) in five periods.
x2 ¼ "ones(size(t2)); 0.2
1
x ¼ [x1 x2]; 0
0.8
xp ¼ repmat(x,1,5);
t1 ¼ 0:.01:1; −0.2
t ¼ linspace(0,10,length(xp)); 0.6 −0.4
t2 ¼ 1.01:.01:2;
plot(t,xp)
x1 ¼ ones(size(t1)); 0.4
−0.6
x2 ¼ "ones(size(t2)); 0.2
−0.8
x ¼ [x1 x2]; 0
xp ¼ repmat(x,1,5); −1
−0.2 0 1 2 3 4 5 6 7 8 9 10
t ¼ linspace(0,10,length(xp)); −0.4
plot(t,xp)
−0.6
−0.8
Afterward, the two-part signal x(t) −1 is defined as the single symbolic expression x(t) ¼
0 1 2 3 4 5 6 7
u(t) " 2u(t " 1), 0 # t # 2, where u(t) is the unit step function. Note that a 8periodic
9 10
signal x(t)
Afterward, the two-part
is entirely determined signal
by its values x(t) is defined
over as the
one period. single
Thus, symbolic
the symbolic expression
expression x(t)is =u(t)-2u(t-1)
of x(t)
, 0< t< 2, where u(t) is the unit step function. Note that a periodic signal
defined only for the time interval of interest, namely, for 0 # t # 2 (one period). The defined x(t) is entirely
symbolic
determined
Afterward, the expression
two-part issignal
by its values plottedx(t)inone
over isone periodas
period.
defined for confirmation.
Thus,
the the symbolic
single symbolicexpression
expression of x(t)
x(t) ¼ is defined only
u(t)for the "time
" 2u(t 1), 0interval of interest,
# t # 2, where namely,
u(t) is the forfunction.
unit step 0< t< 2 (one period).
Note that The defined
a periodic signal x(t)symbolic
is entirely determined by its values over one period.
expression is plotted in one period for confirmation. Thus, the symbolic expression of x(t) is
definedCommands
only for the time interval of interest, namely, for 0 # t # 2 (one period).
Results The defined
symbolic expression is plotted in one period for confirmation.
heaviside(t)−2 heaviside(t−1)
1

Commands 0.5 Results


syms t
x ¼ heaviside(t)"2*heaviside(t"1); 1 0 heaviside(t)−2 heaviside(t−1)
ezplot(x,[0 2]);

0.5 −0.5
syms t
x ¼ heaviside(t)"2*heaviside(t"1); 0 −1
ezplot(x,[0 2]);
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
−0.5 t

Finally, the complex exponential Fourier


−1 series coefficients a k are calculated and the

approximate signal xx(t) is computed and plotted


0 0.2 for0.8
0.4 0.6 0 to110,1.2i.e.,
1.4 for
1.6time
1.8 of
2 five periods. As in
t
the previous examples, xx(t) is computed and plotted for various numbers of exponential terms
used.
Finally, the complex exponential Fourier series coefficients ak are calculated and the
approximate signal xx(t) is computed and plotted for 0 ! t ! 10, i.e., for time of five
periods. As in the previous examples, xx(t) is computed and plotted for various numbers of
exponential terms used.

Commands Results
k ¼ #2:2;
t0 ¼ 0;
T ¼ 2; a ¼ [0, 2*i=pi, 0, #2*i=pi, 0]
w ¼ 2*pi=T;
a ¼ (1=T)*int(x*exp(#j*k*w*t),t,t0,t0þT)

1.5
Approximation with 5 terms
1

0.5
xx ¼ sum(a.*exp(j*k*w*t))
ezplot(xx,[0 10]) 0
title('Approximation with 5 terms')
−0.5

−1

−1.5
0 1 2 3 4 5 6 7 8 9 10
1) Copy and past the codes above and plot in MATLAB. t
2) Calculate Fourier series coefficients for k=-5 to k=5 and use
Approximation the
with 11 code above to plot xx(t)
terms
and check if the calculated coefficients
1 match the coefficients from MATLAB code. For
the calculation part use the properties that we learned in class i.e. example 3.6 and
0.5
table 3.1 on page 206. For example, x(t) is real and odd thus ak should be pure imaginary
k ¼ #5:5;
a ¼ (1=T)*int(x*exp(#j*k*w*t),t,t0,t0þT);
and odd.
xx ¼ sum(a.*exp(j*k*w*t)); 0

3) Plot xxt for k from -5 to 5, -10 to 10,


ezplot(xx,[0 10])
title('Approximation with 11 terms') −0.5-20 to 20 .. -100 to 100.
4) Determine the rang of k where the signal looks close enough to the original signal x(t).
−1

0 1 2 3 4 5 6 7 8 9 10
t

Approximation with 21 terms


1

k ¼ #10:10; 0.5
a ¼ (1=T)*int(x*exp(#j*k*w*t),t,t0,t0þT);
xx ¼ sum(a.*exp(j*k*w*t)); 0
ezplot(xx,[0 10])
title('Approximation with 21 terms') −0.5

−1

0 1 2 3 4 5 6 7 8 9 10
t
(continued)

You might also like