Вы находитесь на странице: 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.

Вам также может понравиться