PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Time Domain Representation of Continuous and Discrete Signals 61


MATLAB Solution
% Script file: graphs
t = -5:.01:5; t0 = 0;
u = stepfun(t,t0);
f1 = 4.5*e x p(-1.4.*t).*cos(8.3.*t+1.25).*u;
subplot(2,1,1);
plot(t,f1);axis([-5 5 -4 5]);
title(‘[f1(t)= 4.5 exp(-1.4.*t).*cos(8.3 *t + 1.25).*u(t)] vs. t’);
ylabel(‘Amplitude [f1(t)]’); xlabel(‘t (time)’);
f2 = fliplr(f1);
subplot(2,1,2);
plot(t,f2);axis([-5 5 -4 5]);
title(‘[f2(t)= f1(-t)] vs. t’);
ylabel(‘Amplitude [f2(t)]’); xlabel(‘t (time)’);
The script fi le graphs is executed and the results are shown in Figure 1.52.

Example 1.5

Create the script fi le disc_square_triang that returns the plots of the following periodic
discrete signals, with period T = 2 , over the range 0 ≤ n ≤ 4 , using the square and saw-
tooth functions

fn

n

(^1) n
30
31 2
()





fn
nn
(^2) nn
630 1
691 2
()


− 



[f1(t) = 4.5 exp(−1.4.t). cos(8.3t + 1.25). u(t)] versus t
4
2
0
− 2
− 4
− (^5) − 4 − 3 − 2 − 101 2 3 4 5
t (time)
t (time)
Amplitude [f1(t)]
Amplitude [f2(t)]
[f2(t) = f1(−t)] versus t
4
2
0
− 2
− 4
− 5 −^4 − 3 − 2 −^1012345
FIGURE 1.52
Plots of Example 1.4.

Free download pdf