PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Time Domain Representation of Continuous and Discrete Signals 33


ylabel( ‘f2(t)’)
axis([0 4*pi -2.5 2.5])
grid on;
title(‘2*Square(t,25) vs t’)
subplot(2,2,3)
plot(t,f3)
axis([0 4*pi -4.5 4.5])
grid on;
ylabel(‘ f3(t) ‘);xlabel(‘ t (time)’)
title(‘3*Square(t,33) vs t’)
subplot(2,2,4)
plot(t,f4)
axis([0 4*pi -5.5 5.5])
grid on;
title(‘4*Square(t,75) vs t’)
ylabel(‘ f4(t) ‘);xlabel(‘ t (time) ’)

The script fi le squares is executed and the results are shown in Figure 1.30.

R.1.107 The MATLAB command sawtooth(t, b) returns a triangular wave, with magni-
tudes between − 1 and + 1 , and a period of T = 2 π. The scalar b, between 0 and
1 , indicates the percent of the period T with positive slope, where the maximum
occurs at the end.

Square(t,50) versus t

3*Square(t,33) versus t 4*Square(t,75) versus t

2*Square(t,25) versus t
1.5
2

0

− 1

− 2

0 5 10

1

1

0.5
0
−0.5
− 1
−1.5
0

4 5

0

0 5 10

− 5

2

0

− 2

− 4

5 10

f1(t) f2(t)

f3(t) f4(t)

0 5 10
t (time) t (time)
FIGURE 1.30
Plots of the function square of R.1.106.
Free download pdf