In many situation we need to convert a continuous statespace model in to a linear difference equation model or ARMA/ARMAX discreet time model. This post describes this conversion with some simple examples.

we will start with a simple example here.

**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

then similarly

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

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

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

so the new model is

So the final model in linear differential equation isx[n+1]=A1*x[n]+B1*u[n]x[n+1]=1/e x[n]

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

or in other words, we can say thatA1=exp(AT);A1=1/e;

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

The final model isX(z)/U(z)=(1-1/e)/(z-1/e);z X(z)-X(z)/e=(1-1/e)U(z);

which is same as earlier one.x[n+1]-1/e x[n]= (1-1/e)u[n]

## No comments:

## Post a Comment