Time Domain Representation of Continuous and Discrete Signals
29
The step function called Heaviside is indicated as follows:
function stepseq = Heaviside(x)
stepseq = (x>=0);
R.1.98 For example, write a program that returns u(t) and u(t − 2), using the function
Heaviside, over the range −10 ≤ t ≤ 10.
MATLAB Solution
>> x = -10:0.1:10;
>> stepfun = Heaviside(x);
>> subplot(2, 1, 1);
>> plot(x, stepfun)
>> xlabel(‘t (time)’)
>> title(‘u(t) vs. t’)
>> ylabel(‘Amplitude.’)
>> axis([-10 10 ,0.5 1.5])
>> subplot(2, 1, 2);
>> stepfun = Heaviside(x-2);
>> plot(x, stepfun)
>> axis([-10 10 ,0.5 1.5])
>> title(‘u(t-2) vs. t’)
>> ylabel(‘Amplitude.’);
>> xlabel(‘t (time)’);
See Figure 1.27.
R.1.99 The MATLAB function sign(t) is defi ned as follows:
sign t
t
t
t
( ) ϭ
Ͼ
ϭ
Ͻ
1
0
0
0
1
0
Ϫ
The sign(t) function is illustrated in Figure 1.28.
FIGURE 1.27
Plots of u(t) and u(t − 2) of R.1.98.
1.5
Amplitude
Amplitude
1
−10 −8 −6
−4 −2
0
2
4
6
8
10
0.5
1.5
1
0.5
−10 −8 −6
−4
−2
0
2
4
6
8
10
t (time)
u(t) versus t
u(t − 2) versus t
t (time)
CRC_47760_CH001.indd 29
CRC_47760_CH001.indd 29
7/25/2008 4:16:16 PM
7/25/2008 4:16:16 PM
29
The step function called Heaviside is indicated as follows:
function stepseq = Heaviside(x)
stepseq = (x>=0);
R.1.98 For example, write a program that returns u(t) and u(t − 2), using the function
Heaviside, over the range −10 ≤ t ≤ 10.
MATLAB Solution
>> x = -10:0.1:10;
>> stepfun = Heaviside(x);
>> subplot(2, 1, 1);
>> plot(x, stepfun)
>> xlabel(‘t (time)’)
>> title(‘u(t) vs. t’)
>> ylabel(‘Amplitude.’)
>> axis([-10 10 ,0.5 1.5])
>> subplot(2, 1, 2);
>> stepfun = Heaviside(x-2);
>> plot(x, stepfun)
>> axis([-10 10 ,0.5 1.5])
>> title(‘u(t-2) vs. t’)
>> ylabel(‘Amplitude.’);
>> xlabel(‘t (time)’);
See Figure 1.27.
R.1.99 The MATLAB function sign(t) is defi ned as follows:
sign t
t
t
t
( ) ϭ
Ͼ
ϭ
Ͻ
1
0
0
0
1
0
Ϫ
The sign(t) function is illustrated in Figure 1.28.
FIGURE 1.27
Plots of u(t) and u(t − 2) of R.1.98.
1.5
Amplitude
Amplitude
1
−10 −8 −6
−4 −2
0
2
4
6
8
10
0.5
1.5
1
0.5
−10 −8 −6
−4
−2
0
2
4
6
8
10
t (time)
u(t) versus t
u(t − 2) versus t
t (time)
CRC_47760_CH001.indd 29
CRC_47760_CH001.indd 29
7/25/2008 4:16:16 PM
7/25/2008 4:16:16 PM
