ECE 2111 Signals and Systems Spring 2013, UMD Experiment …kulka099/5.pdf · ECE 2111 Signals and...
Transcript of ECE 2111 Signals and Systems Spring 2013, UMD Experiment …kulka099/5.pdf · ECE 2111 Signals and...
1
ECE 2111 Signals and Systems
Spring 2013, UMD
Experiment 5: Fourier Series
Consider the continuous time signal given by
y(t) = A0 + A
1 cos (2π f
0 t + θ
1 ) + A
2 cos (4π f
0 t + θ
2 ) + A
3 cos (6π f
0 t + θ
3 ) +…..
where A0
is the DC component of the signal, Ak
are the amplitude of the harmonics, k is
the harmonic number, and θk
are the phase angle of the harmonics. The expression for a
Fourier Series representation of a function signal x(t) with N harmonics is
The features of a signal given by this equation can be studied in terms of the frequency,
amplitudes, and phases of the sinusoidal terms. The amplitudes A1, A
2, A
3, . . , A
n specify
the relative weights of the frequency components of the particular signal. These weights
are a major factor in determining the shape of the signal. The phase angle of a
trigonometric component controls the position of the component along the time axis.
In the first part of the experiment you will investigate the effect of the magnitude and
phase angle components. You will be asked to change the amplitude and phase values
and compare the resulting waveform to the original one.
I. Harmonic Components of Periodic Signals Consider that signal
y(t) = A0 + A
1 cos (2π f
0 t + θ
1 ) + A
2 cos (4π f
0 t + θ
2 ) + A
3 cos (6π f
0 t + θ
3 )
with period of T0 = 0.1 sec and the component values given in the following Table
2
a) Show the harmonic components and waveforms synthesized by using
2 and 3 harmonic components.
f0=10; % Define the frequency of the signal t = 0:0.001:1; harm1 = cos(2*pi*10*t); harm2 = 2*cos(2*pi*20*t+45/180*pi); signa2 = harm1 + harm2; harm3 = 1*cos(2*pi*30*t+60/180*pi); signa3 = signa2 + harm3 figure(1) subplot(2,3,1); plot(t,harm1) subplot(2,3,2); plot(t,harm2) subplot(2,3,3); plot(t,harm3) subplot(2,3,4); plot(t,signa2) subplot(2,3,5); plot(t,signa3)
Now you will study the importance of the magnitude and the phase angle of each
harmonic component by changing them and comparing the resulting waveform to the
original one.
Lab report:
1)Labeled plots
b) Changing the magnitude of the harmonics
Change the magnitude of the second harmonic from A2
= 2 to A2
= 1.6, 1.2 and 1
respectively. Modify the MATLAB script of a).
Lab report: 2)Labeled plots (A
2=1.6, 1.2, 1)
3)Comment on the change of waveform shape
c) Changing the phase of the harmonics
Change the phase angle of the second harmonic from θ2 = 45
o
to θ2 = 35
o
, 25 o
, and 10 o
respectively. Modify the MATLAB script of a).
Lab report:
4)Labeled plots (θ2=35
o
, 25 o
, 10 o
)
5)Comment on the change of waveform shape
d) Adding an harmonic to the signal y(t)
3
Using the original waveform with the three harmonics given in Table 1, create another
waveform by adding a 4th harmonic with a magnitude of 1.5 and a phase angle of 120o
.
Lab report:
6)Labeled plots showing the signal containing the 4th
harmonic
7)Comparison between the new signal and the original signal
II. Magnitude Spectra and the partial Fourier Series Compute and plot the magnitude spectrum and the partial Fourier series sums of two
periodic signals: a square wave, and a triangular wave.
a) Magnitude Spectrum of a Square Wave
The following MATLAB script defines an odd square wave (period 1 sec, no DC level, 2
Vpp) % Program to give partial Fourier sums of an % odd square wave of 2 Vpp amplitude n_max = input('Enter vector of highest harmonic values desired
(odd):'); f = 1; N = n_max; t = 0:0.002:1; omega_0 = 2*pi*f; x=zeros(size(t)); n=1:1:N; b_n=zeros(size(n)); for i=1:(N+1)/2; k=2*i-1; b_n(k)=4/(pi*k); % This part is for plotting the Magnitude spectrum figure(1) subplot(2,1,1),stem(b_n);
xlabel('Integer Multiple of Fundamental Frequency'); ylabel('Amplitude'),grid; % This part is for plotting the partial Fourier sum
x=x+b_n(k)*sin(omega_0*k*t); subplot(2,1,2),plot(t,x),xlabel('t'),ylabel('partial sum'); axis([0 1 -1.5 1.5]),text(0.05,-0.5, ['max.har.=',num2str(k)]); grid; end
Type the number of harmonics (e.g. 1, 3, up to 15) you want to plot, when you see the
following line as you run the program Enter vector of highest harmonic values desired (odd):
The Fourier series components for this signal is a summation of odd harmonics of the
sine wave with a magnitude of 4/(πk) , where k is the harmonic number. Using
4
MATLAB compute the magnitude of the harmonics coefficients, that is, b1, b
2, b
3, b
4,…,
bn. Plot the amplitude spectrum (line spectrum) of the square wave and plot the partial
Fourier sums starting from 1 harmonic till 15 harmonics.
Lab report: 8)Labeled plot(for 15 harmonics)
9)Find magnitude b1, b
2, …, b
15 in Workspace and put them down
10)Describe how the command a = input (‘b’) works
b) Magnitude Spectrum of a triangular Wave
The following MATLAB script defines a triangular wave (period 1 sec, no DC level, 2
Vpp) % Program to give partial Fourier sums of a % Triangular wave of 2 Vpp amplitude n_max = input('Enter vector of highest harmonic values desired
(odd):'); f = 1; N = n_max; t = 0:0.002:1; omega_0 = 2*pi*f; x=zeros(size(t)); n=1:1:N a_n=zeros(size(n)); for i=1:(N+1)/2; k=2*i-1; a_n(k)=8/(pi^2*k*k) % This part is for plotting the Magnitude spectrum figure(2) subplot(2,1,1); stem(a_n); xlabel('Integer Multiple of Fundamental Frequency'); ylabel('Amplitude'),grid; % This part is for plotting the partial Fourier sum
x=x+a_n(k)*cos(omega_0*k*t); subplot(2,1,2),plot(t,x),xlabel('t'),ylabel('partial sum'); axis([0 1 -1.5 1.5]),text(0.05,-0.5, ['max.har.=',num2str(k)]),grid; end
The Fourier series components for this signal is a summation of the harmonics of the
cosine wave with a magnitude of 8/(π2
k2
) , where k is the harmonic number. Using
MATLAB compute the magnitude of the harmonics coefficients, that is, a1, a
2, a
3, a
4,…,
an. Plot the amplitude spectrum (line spectrum) of the square wave and plot the partial
Fourier sums starting from 1 harmonic till 15 harmonics.
Lab report:
11)Labeled plot (for 15 harmonics)
5
12)Find magnitude a1, a
2, …, a
15 in Workspace and put them down.
Report Requirements:
• Individual lab report
• Attached with the cover page (available on the website)
This lab report should contain the following:
1. Statement of the Problem: Define the problem and goals of the experiment.
2. Results: Points 1-12 given in the lab sheet above
3. Exercises: Attached
4. Conclusions: Give comments to the lab.
Exercises:
Connect the correct Fourier Series name with its corresponding representation:
Trigonometric
Complex Exponential
Compact