EE 451

Problem 4.20 from Orfanidis

% Problem 4.20 from Orfanidis
%
% Write state equations
%
% v1(n+1) = 0 v1(n) + 1 v2(n) + 0 v3(n) + h1 x(n)
% v2(n+1) = 0 v1(n) + 0 v2(n) + 1 v3(n) + h2 x(n)
% v3(n+1) = 0 v1(n) + 0 v2(n) + 0 v3(n) + h3 x(n)
%
% y(n) = 1 v1(n) + 0 v2(n) + 0 v3(n) + h0 x(n)
%
% Write state matrices from above equations
%
%       0 1 0       h1
%  A =  0 0 1  B =  h2   C = 1 0 0   D = h0
%       0 0 0       h3

% Define impulse response values

h0 =  1
h1 =  2;
h2 = -1;
h3 =  1;

% Enter state matrices

A = [0 1 0;0 0 1;0 0 0];
B = [h1;h2;h3];
C = [1 0 0];
D = h0;

% Define input -- length is Length(x) + Length(h) - 1

x = [1 1 2 1 2 2 1 1 0 0 0]';

% Use dlsim to find output and state variables.
% Column 1 of v will be v1, column 2 will be v2, and column 3 will be v3

[y,v] = dlsim(A,B,C,D,x)


Bill Rison, <rison@ee.nmt.edu >