Professional Documents
Culture Documents
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.
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?