PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

404 Practical MATLAB® Applications for Engineers


ANALYTICAL Solution

Part 1. From Table 4.1, the FT of f(t) = e−^2 tu(t) ↔ 1/(jw + 2) (transform # 10).
Part 2. From Table 4.2, the LT of f(t) = e−^2 tu(t)↔ 1/(s + 2) (transform # 5).
Part 3. The magnitude equations for the Fourier and LTs are

Fw
w

Fs
s

()
()

()
()







1
2

1

(^22222)
The phase equations for the Fourier and LTs are
Phase[F(w)] = −tan−^1 (w/ 2 ) (Fourier)
Phase[F(s)] = −tan−^1 (s/ 2 ) (Laplace)
MATLAB Solution
% Script file: Fourier _ Laplace
t = -2:0.05:2;
ft = e x p(-2.t).stepfu n(t,0);
figure(1)
subplot(2,1,1)
plot(t,ft)
xlabel(‘time (in sec)’);ylabel(‘Amplitude’);
axis([-2 2 -.5 1.25]);
title(‘exp(-2t)u(t) vs. t ‘)
subplot(2,1,2)
ftsquare = ft.^2; plot(t,ftsquare)
xlabel(‘time (in sec)’);ylabel(‘Amplitude’);
axis([-2 2 -.5 1.25]);
title(‘[exp(-2t)u(t)]^2 vs t’)
% evaluates integral of exp(-2t) from 0 to inf.
symint = int(‘(exp(-2
t)Heaviside(t))’,0,inf);
symintsq = int(‘(exp(-4
t)*Heaviside(t))’,0,inf);
disp(‘**’)
disp(‘**** R E S U L T S *****’)
disp(‘****’)
disp(‘The int(exp(-2t)u(t)) from t=0 to inf is =’)
disp(symint)
vpa(symint)
disp(‘****’)
disp(‘****’)
disp(‘The int(exp(-2t)^2u(t)) from t=0 to inf is =’)
disp(symintsq)
vpa(symintsq)
disp(‘****’)
w =-6:0.1:6;
Fw =1./sqrt(4+w.^2); % mag [e^(-2*t) u(t)] and
phase =-atan(w/2); % phase from table of F.T
figure(2)
subplot(2,2,1);plot(w,Fw)
xlabel(‘frequency w’);ylabel(‘Magnitude of F(w)’)
title(‘Magnitude spectrum/Fourier’);

Free download pdf