Digital Signal Processing Reference
In-Depth Information
Similarly, using the past output yð0Þ¼0:5, we get
xð2Þ¼ð0:5Þ
2 uð2Þ¼0:25
yð2Þ¼0:5yð0Þþxð1Þ¼0:5,ð0:5Þþ0:5 ¼ 0:25
and with yð1Þ¼1:0, we yield
xð3Þ¼ð0:5Þ
3 uð3Þ¼0:125
yð3Þ¼0:5yð1Þþxð2Þ¼0:5,1 þ 0:25 ¼ 0:75
.........
Clearly, yðnÞ could be recursively computed for n > 3.
b. Setting n ¼ 0, we obtain
xð0Þ¼ð0:5Þ
0 uð0Þ¼1
yð0Þ¼0:5yð2Þþxð1Þ¼0,1 þ 0 ¼ 0
Setting n ¼ 1, we achieve
xð1Þ¼ð0:5Þ 1 uð1Þ¼0:5
yð1Þ¼0:5yð1Þþxð0Þ¼0,0 þ 1 ¼ 1
Similarly, with the past output yð0Þ¼0, we determine
xð2Þ¼ð0:5Þ
2 uð2Þ¼0:25
yð2Þ¼0:5yð0Þþxð1Þ¼0:5,0 þ 0:5 ¼ 0:5
and with yð1Þ¼1, we obtain
xð3Þ¼ð0:5Þ
3 uð3Þ¼0:125
yð3Þ¼0:5yð1Þþxð2Þ¼0:5,1 þ 0:25 ¼ 0:75
.........
Clearly, yðnÞ could be recursively computed for n > 3
EXAMPLE 6.2
Given the DSP system yðnÞ¼2xðnÞ4xðn 1Þ0:5yðn 1Þyðn 2Þ
n uðnÞ, compute the
with initial conditions yð2Þ¼1, yð1Þ¼0, xð1Þ¼1, and the input xðnÞ¼ð0:8Þ
system response yðnÞ for 20 samples using MATLAB.
Solution:
Program 6.1 lists the MATLAB program for computing the system response yðnÞ. The top plot in Figure 6.2 shows
the input sequence. The middle plot displays the filtered output using the initial conditions, and the bottom plot
shows the filtered output for zero initial conditions. As we can see, the system outputs are different at the
beginning, but they approach the same value later.
Program 6.1. MATLAB program for Example 6.2.
% Example 6.2
% Compute y(n) ¼ 2x(n)-4x(n-1)-0.5y(n-1)-0.5y(n-2)
% Nonzero initial conditions:
% y(-2) ¼ 1, y(-1) ¼ 0, x(-1) ¼ -1, and x(n) ¼ (0.8)^n*u(n)
%
y ¼ zeros(1,20);
% Set up a vector to store y(n)
y ¼ [ 1 0 y];
% Add initial condition of y(-2) and y(-1)
n ¼ 0:1:19;
% Compute time indexes
x ¼ (0.8).^n;
% Compute 20 input samples of x(n)
Search WWH ::




Custom Search