# Converting a continuous statespace model to ARMA model

**Example 1: Conversion of First Order Differential Equation to Linear Difference Equation**

we will start with a simple example here. * ***Problem:***Let us take a simple first order differential equation: *

dx

----- = - x

dt

*This state space model is with A=-1 and B=0,*

*we want to discreetize it with T=1s and get a linear differential equation model;*

**Solution:**First calculate A1 and B1 as following:

1. Using the properties of z=e^-(st), we get that

A1=exp(AT);A1=1/e;

or in other words, we can say that

A1=Linv((sI-A)^-1) with t=T;

A1=Linv(1/(s+1)) =exp(-t) at (t=T) =e^-1

then similarly

B1= A^-1 (A1-I)B;= -1(e-1)*0 = 0

** **

so the new model is

x[n+1]=A1*x[n]+B1*u[n]x[n+1]=1/e x[n]

So the final model in linear differential equation is

x[n+1]-1/e x[n]=0

is the ARM model you wanted

Note :

exp used is matrix exponential

exp(A)= I+A+A^2/2!+A^3/3!+... = Linv{(sI-A)^-1}

**Example 2: Considering the Inputs**

**Problem:***Now consider this*

dx

---- =-x+u(t);

dt

**Solution:**So we have

A1=exp(AT);A1=1/e;

or in other words, we can say that

Linv((sI-A)^-1) with t=T;

A1=Linv(1/(s+1)) =exp(-t) at (t=T) = e^-1

then

B1= inv(A)(A1-I)B;=-1(1/e-1)*1=1-1/e;

so the new model is

x[n+1]=A1 x[n]+B1u[n]x[n+1]=1/e x[n]+(1-1/e)u[n];x[n+1]-1/e x[n]=(1-1/e)u[n];

x[n+1]-1/e x[n]=(1-1/e)u[n];

**Another Method Using Transfer Functions**Let us learn one more method for this.

first calculate the transfer function of this state space model

which is

which is

G(s)= 1/(s+1);

now discreetize it by using

z=exp(sT)=exp(s) as T=1;

This pretty tricky so we will take the help of MATLAB here to calculate it.

On MATLAB, write the following :

%make the transfer function using tf

g=tf(1,[1 1]);%convert it to discreet

g1=c2d(g,1);

you will get

g1=(1-1/e)/(z-1/e);

Now it is very easy to convert it to time domain

X(z)/U(z)=(1-1/e)/(z-1/e);z X(z)-X(z)/e=(1-1/e)U(z);

The final model is

x[n+1]-1/e x[n]= (1-1/e)u[n]

which is same as earlier one.