Christopher Belcastro
ECE 2704
Homework #10
November 21, 2006
Problem 1 - MATLAB CODE:
a)
clear
% Define the signal parameters
T0 = 2;
% period of the signal
ep = .5;
% pulse width, less than T0
t0 = 0;
% offset
A = 1;
% amplitude
w0 = 2*pi/T0;
% fundamental frequency
% Number of terms in the Fourier series
nterm = 25;
% Calculate coefficients of exponential Fourier series
X0 = 1/4;
% m= 0 term
for
kk = 1:nterm
% m=1,2,..,10 terms
X(kk) = (0.5*exp(-j*kk*pi)*(1/(kk*pi)^2-1/(j*kk*pi))-0.5*(1/(kk*pi)^2));
end
% Calculate coefficients of cosine Fourier series
Am = 2*abs(X);
qm = angle(X);
% Calculate the partial sums of the Fourier series
t = linspace(-2.5*T0+ep/2,2*T0-ep/2,400);
% time vector
x = X0*ones(size(t));
% constant term
for
jj = 1:nterm
x = x + Am(jj)*cos(jj*w0*t+qm(jj));
end
% Calculate two-sided amplitude and phase spectrum
Xt = abs(X);
Xp = angle(X);
Amp = [fliplr(Xt),X0,Xt];
% Amplitude spectrum
Phs = [-fliplr(Xp),angle(X0),Xp];
% Phase spectrum
% Calculate frequencies of Fourier series terms
w = [-nterm:nterm]*w0;
% Plot amplitude spectrum
figure(2)
plot(w,Amp,
'o'
);
%axis([-nterm*w0-1,nterm*w0+1,0,0.8])
title(
'Two-Sided Amplitude Spectrum'
)
xlabel(
This
preview
has intentionally blurred sections.
Sign up to view the full version.

This is the end of the preview.
Sign up
to
access the rest of the document.
- Fall '08
- DJStilwell
- Fourier Series, Christopher A. Belcastro, Two-Sided Amplitude Spectrum, Two-Sided Phase Spectrum
-
Click to edit the document details