4.9 Response of LTI Systems to Periodic Signals 275
M = length(x);
figure(1)
x1 = [zeros(1, 5) x(1:M)];
z = y(1); y1 = [zeros(1, 5) z zeros(1, M−1)];
t0 =− 5 ∗Ts:Ts:Tend;
for k = 0:M−6,
pause(0.05)
h0 = fliplr(h);
h1 = [h0(M - k - 5:M) zeros(1, M - k - 1)];
subplot(211)
plot(t0, h1, ’r’)
hold on
plot(t0, x1, ’k’)
title(’Convolution of x(t) and h(t)’)
ylabel(’x(τ), h(t-τ)’); grid; axis([min(t0) max(t0) 1.1*min(x) 1.1*max(x)])
hold off
subplot(212)
plot(t0, y1, ’b’)
ylabel(’y(t) = (x∗h)(t)’); grid; axis([min(t0) max(t0) 0.1∗min(x) 0.1∗max(x)])
z = [z y(k + 2)];
y1 = [zeros(1, 5) z zeros(1, M - length(z))];
end
Figure 4.14 displays the last step of the convolution integral simulation. Notice that the steady state
is attained in a very short time (aroundt=0.5 sec). The transient changes every time that the script
is executed due to the random phase.
FIGURE 4.14
Convolution simulation: (a) inputx(t)(solid line) and
h(t−τ)(dashed line), and (b) outputy(t): transient
and steady-state response.
0 0.5 1
(a)
(b)
1.5 2
− 10
− 5
0
5
10
x(
τ),
h
(t
−τ
)
τ
0 0.5 1 1.5 2
−0.5
0
0.5
y(
t)
=
(x
*h
)(t
)
t