PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

402 Practical MATLAB® Applications for Engineers


% Script file: square _ FT _ sym
% This file returns the expressions and plots for the pulse
% spectrums for tau’s= 1,5, and10
syms t w
Fw1 = fourier(sym(‘Heaviside(t+1/2)’)- sym(‘Heaviside(t- 1/2)’),t,w);
Fw5 = fourier(sym(‘Heaviside(t+2.5)’)- sym(‘Heaviside(t- 2.5)’),t,w);
Fw10 = fourier(sym(‘Heaviside(t+5)’)- sym(‘Heaviside(t-5)’),t,w);
disp(‘******************************************’)
disp(‘ ***********R E S U L T S ************’)
disp(‘******************************************’);
disp(‘The FT of the rect pulse with tau =1, 5 and 10 are given by:’);
Fw1sim = simplify(Fw1)
Fw5sim = simplify(Fw5)
Fw10sim = simplify(Fw10)
disp(‘******************************************’);
figure(1)
subplot(3,1,1)
ezplot(Fw1sim,[-10 10])
ylabel(‘ Amplitude’)
title(‘ Spectrum of the pulse for tau=1.0’)
subplot(3,1,2)
ezplot(Fw5sim,[-10 10])
axis([-10 10 -4 6])
ylabel(‘ Amplitude’)
title(‘ Spectrum of the pulse for tau= 5’)
subplot(3,1,3)
ezplot(Fw10sim,[-10 10])
axis([-4 4 -6 11])
xlabel(‘frequency w (in rad/sec’),
ylabel(‘ Amplitude’)
title(‘ Spectrum of the pulse for tau=10’)

The script fi le square_FT_sym is executed and the results are as follows (Figure 4.51):

>> square _ FT _ sym

*****************************************************************
*************************R E S U L T S *************************
*****************************************************************
The FT of the rect pulse with tau =1, 5 and 10 are given by :
Fw1sim =
2*sin(1/2*w)/w

Fw5sim =
2.*sin(2.5000000000000000000000000000000*w)/w

Fw10sim =
2*sin(5*w)/w
******************************************************************

Observe that the spectrum expressions obtained using the MATLAB symbolic toolbox
shown in Figure 4.51 fully agree with the transform of Table 4.1 and the spectrum plots
of part 2 shown in Figure 4.52.
Free download pdf