Fourier Series

advertisement
ECE 5765 Modern Communication
Fall 2006, UMD
Experiment 3: Fourier Series
Consider the continuous time signal given by
y(t) = A0 + A1 cos (2π f0 t + θ1 ) + A2 cos (4π f0 t + θ2 ) + A3 cos (6π f0 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, A2, A3, . . , An 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.
Part 1. Harmonic Components of Periodic Signals
Consider that signal
y(t) = A0 + A1 cos (2π f0 t + θ1 ) + A2 cos (4π f0 t + θ2 ) + A3 cos (6π f0 t + θ3 )
with period of T0 = 0.1 sec and the component values given in the following Table
Component
Magnitude (Ak) Phase (θk)
DC level (average)
0
Fundamental
1
0
nd
2 harmonic
2
45o
3th harmonic
1
60o
Table 1 Harmonic components of the signal
a) Enter the following MATLAB code in an M-file to show the harmonic components and
waveforms synthesized by using 2 and 3 harmonic components.
Hint:
To open an M-file you have to go to File menu in the command prompt page and select New M-file.
Then the M-file editor will show up. After writing your program save it to a location and memorize
it.
Now to use your program in the command prompt page first you have to specify the location your
program is located and you can do so by typing the following:
cd C:\ Documents and Settings\ece\desktop\the only place to save
After typing that you type your program name on the screen and it will be executed.
f0=10;
% Define the period of the signal
t = 0:0.001:01;
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 phase angle of these components by
changing them and comparing the resulting waveform to the original one.
Changing the magnitude of the harmonics
b) Change the magnitude of the second harmonic from A2 = 2 to A2 = 1 by reducing it in a step of
0.1. Modify the MATLAB script of a) in accordance to the change, and re-synthesize the waveforms.
Describe what changes where made in the shapes of the waveforms.
Changing phase of the harmonics
d) Change the phase angle of the second harmonic from θ2 = 45o to θ2 = 10o by reducing it in a step
of 5o. Change the MATLAB script of a) in accordance to the change, and re-synthesize the
waveforms. Describe what changes where made in the shapes of the waveforms.
Adding an harmonic to the signal y(t)
f) 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 . Plot the results and
compare the shapes with the original signal.
Part 2. Magnitude Spectra and the partial Fourier Series
In this part of the experiment you will 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) using
the M-file.
% 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 = length(n_max);
t = 0:0.002:1;
omega_0 = 2*pi*f;
for k=1:N
n=[];
n=[1:2:n_max(k)];
b_n=4./(pi*n)
% This part is for plotting the Magnitude spectrum
figure(1)
subplot(N,1,k),stem(n,b_n),xlabel('Integer Multiple of Fundemental
Frequency'),ylabel('Amplitude'),grid
x=b_n*sin(omega_0*n'*t)
% This part is for plotting the partial Fourier sum
figure(2)
subplot(N,1,k),plot(t,x),xlabel('t'),ylabel('partial sum'),...
axis([0 1 -1.5 1.5]),text(0.05,-0.5, ['max.
har.=',num2str(n_max(k))]),grid
end
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 MATLAB compute the magnitude of
the harmonics coefficients, this is, b1, b2, b3, b4,…, bn. Plot the amplitude spectrum (line spectrum) of
the square wave and Plot the partial Fourier sums starting from 1 harmonic till 15 harmonics. Write
down your conclusions. (Refer to Fig 4.3 of Kamen)
b) Magnitude Spectrum of a triangular Wave
The Fourier series components for this signal is a summation of the harmonics of the cosine wave
with a magnitude of 4/(π2k2) , where k is the harmonic number. Using MATLAB compute the
magnitude of the harmonics coefficients, this is, a1, a2, a3, a4,…, an. Plot the amplitude spectrum (line
spectrum) of the square wave and Plot the partial Fourier sums starting from 1 harmonic till 15
harmonics. Write down your conclusions.
The following MATLAB script defines a triangular wave (period 1 sec, no DC level, 2 Vpp) using
the M-file.
% 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 = length(n_max);
t = 0:0.002:1;
omega_0 = 2*pi*f;
for k=1:N
n=[];
n=[1:2:n_max(k)];
a_n=4./(pi^2*n.*n)
% This part is for plotting the Magnitude spectrum
figure(1)
subplot(N,1,k),stem(n,a_n),xlabel('Integer Multiple of Fundemental
Frequency'),ylabel('Amplitude'),grid
x=a_n*cos(omega_0*n'*t);
% This part is for plotting the partial Fourier sum
figure(2)
subplot(N,1,k),plot(t,x),xlabel('t'),ylabel('partial sum'),...
axis([0 1 -1.5 1.5]),text(0.05,-0.5, ['max.
har.=',num2str(n_max(k))]),grid
end
Questions:
1.- Given the signal: square wave, no DC level, period = 1 sec, amplitude = 2 Vpp
a)�Determine the Trigonometric Fourier Series
b)�Determine the Complex Exponential Fourier Series
2.- Explain Why did we get some overshot the at the edges of the square wave even if we include
a lot of harmonics?
3. Generate a square wave and a triangular wave using signal generator or master signals and look the
using picosope. See if you get the correspondence between your calculated and measured spectrums.
(keep the signal frequency 1KHz)
4. Please state what you have learned from the lab including any comments about the results.
Download