0% found this document useful (0 votes)
33 views5 pages

Comm Asst 01

The document contains Matlab code to generate and analyze square pulse and triangular pulse signals: 1) It generates code to plot a square pulse waveform in the time domain and its Fourier transform in the frequency domain. 2) It generates a pulse train with a 200us period and 50% duty cycle, plots it in the time domain, and takes the Fourier transform to view in the frequency domain. 3) It generates a triangular pulse train with a 1us pulse duration, 2V amplitude, and 2us period centered around 0, plots it in the time domain, and takes the Fourier transform to view in the frequency domain. It then plots the addition of the first 1, 2, 3, 5,

Uploaded by

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

Comm Asst 01

The document contains Matlab code to generate and analyze square pulse and triangular pulse signals: 1) It generates code to plot a square pulse waveform in the time domain and its Fourier transform in the frequency domain. 2) It generates a pulse train with a 200us period and 50% duty cycle, plots it in the time domain, and takes the Fourier transform to view in the frequency domain. 3) It generates a triangular pulse train with a 1us pulse duration, 2V amplitude, and 2us period centered around 0, plots it in the time domain, and takes the Fourier transform to view in the frequency domain. It then plots the addition of the first 1, 2, 3, 5,

Uploaded by

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

Q1.

(a) Consider a square pulse with 100 duration and an amplitude of 2. Using Matlab plot the
pulse waveform.
closeall;
clearall;
fs = 2.5;
t = -1:.0004/fs:2.5;
x1 = 2*rectpuls(t,200e-3);
subplot(211)
plot(t,x1)
axis([0 0.4 -0.1 2.2])
xlabel('Time (sec)');
ylabel('Amplitude');
title('SquarePulse');

(b) Using fundamental formulas in Matlab, find the Fourier transform plot of the same signal
Program to generate a continuous time square wave
closeall;
clearall;
fs = 2.5;
t = -1:.0004/fs:2.5;
x1 = 2*rectpuls(t,200e-3);
subplot(211)
plot(t,x1)
axis([0 0.4 -0.1 2.2])
xlabel('Time (sec)');
ylabel('Amplitude');
title('SquarePulse');
%frequency domain plot
subplot(2,1,2);
plot(abs(fftshift(fft(x1))));

(c) Now consider a square pulse train with 200 period, 50% duty cycle and an amplitude of 2. Using
the result /codes in (b), derive and plot the Fourier transform of this pulse train.
closeall;
clearall;
%pulse train
t = 0 : 1/1e3 : 10;
% 1 kHz sample freq for 10 s
d = 0 : 1/5 : 10;
% 5 Hz repetition frequency (10 s period)
y = 2*pulstran(t,d,'rectpuls',0.1); % 2V pulse train
subplot(2,1,1);
plot(t,y)
axis([0 5 0 3])
xlabel'Time (s)', ylabelAmplitude

%fourier transform of pulse train


subplot(2,1,2);
plot(abs(fftshift(fft(t))));
xlabel'Frequency (Hz)', ylabelAmplitude

Q2.
(a) A periodic triangular pulse train consists of pulses with 1duration and isosceles triangles occurring
with 2maximum amplitude. Total duration of a period is 2on which the trigular pulse is centered.
Use Matlab to find the Fourier series coefficients of this signal
closeall;
clearall;
fs = 500;
t = -1:1/fs:1;
x1 = 2*tripuls(t,200e-3);
subplot(211)
plot(t,x1)
axis([-0.4 0.4 -0.2 2.2])
xlabel('Time (sec)');
ylabel('Amplitude');
title('Triangular Pulse');
%frequency domain plot
subplot(2,1,2);
plot(abs(fftshift(fft(x1))));

(b) Hence find and plot the additions for 1,2,3,5,10and 50 harmonics.

(c) Let the added number of harmonics be (). Show that the Gibbs phenomenon occurs in this
combining of harmonics.

You might also like