Finding the Impulse Response Function for a state space model

1.2k Views Asked by At

I have converted the following ARMA model:

$$y(t+3)-y(t+2)-y(t+1)+y(t)=u(t+1)+2u(t)$$

into the following state space model:

$$x(t+1)=\begin{pmatrix}0 & 0 & -1\\ 1 & 0 & 1 \\ 0 & 1 & 1\\ \end{pmatrix}x(t)+\begin{pmatrix}2\\1\\0\\\end{pmatrix}u(t)$$

$$y(t)=\begin{pmatrix}0 & 0 & 1\\\end{pmatrix}x(t)$$

Where the Impulse Response function $I(t)=c^T*A^{t-1}*b$.

Where $$c=\begin{pmatrix}0 & 0 & 1\\\end{pmatrix}$$

$$A=\begin{pmatrix}0 & 0 & -1\\ 1 & 0 & 1 \\ 0 & 1 & 1\\ \end{pmatrix}$$

$$b=\begin{pmatrix}2\\1\\0\\\end{pmatrix}$$

I have then used Matlab to plot the Impulse Response function for discrete time for $0\le t \le 20$ and I have this graph:

plot

My Matlab code is this:

clear
A=[0 0 -1; 1 0 1; 0 1 1]; % define matrices
b=[2 ; 1; 0]; 
c=[0 ; 0 ; 1];

y(1)=0; % impulse response function
tt(1)=0;

for i=0:20
    tt(i+1)=i;
    y(i+1)=c'*A^(i-1)*b;
end

figure(1)
plot(tt,y)
title('(b) impulse response function')

Is this correct? I've seen other examples of Impulse Response functions and they seem to oscillate around the x-axis and mine obviously seems different.

1

There are 1 best solutions below

0
On BEST ANSWER

First you need to derive a transfer function from your recurrence relation and the $z$-transform. The trick is to consider the farthest term from $t$, (here $t+3$) as the reference and then put $z^{-n}$ for each term where $n$ is the distance from that reference: $$y(t+3)-y(t+2)-y(t+1)+y(t)=u(t+1)+2u(t)\\ \implies Y(z)(1-z^{-1}-z^{-2}+z^{-3})=U(z)(z^{-2}+2z^{-3})$$ So the transfer function is $$G(z)=\frac{Y(z)}{U(z)}=\frac{z+2}{z^3-z^2-z+1}=\frac{z+2}{(z+1)(z-1)^2}$$ and you won't need to compute a state-space model for obtaining the impulse-response:

sys = tf([1,2], [1,-1,-1,1], 1); % sampling period = 1 sec
impulse(sys, 20) % t_f = 20
title('(b) impulse response function')

As a side-note, since the system has a double-pole at $z=1$, it would be unstable. You can also verify this by taking the inverse $z$-transform of the transfer function, which is the impulse response! $$g[n]=\mathcal Z^{-1}\{G(z)\}=\frac 14\left(6n-7+(-1)^{n-1}\right)u[n-1]$$