help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lsim vs. filter for simulation in Octave 2.1.50


From: Geraint Paul Bevan
Subject: Re: lsim vs. filter for simulation in Octave 2.1.50
Date: Sat, 18 Oct 2003 08:48:43 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

E. Joshua Rigler wrote:
| Actually, my parameterization gives me exactly the same impulse response
| as the parameterization you present.  However, I wasn't actually trying
| for an ARMAX model, but rather a 1st order OE (output error) model with
| input feedthrough at zero lag (i.e.
|
|   ^         1         ^         1
|   y(n) = - SUM a(k+1) y(n-k) + SUM b(k+1) x(n-k)
|            k=1                 k=0
|
| So I am even more confused than before.  Thanks for your help though.
|
| -EJR
|
|

Sorry, I didn't mean to confuse, momentary lapse of reason and all that ...

I meant ARX, not ARMAX, which I think is essentially the same as an OE
model except for the treatment of the noise term.

State space representations don't contain time history data, so for each
previous input or output used in the OE model, a state will be required
to hold its value. In this case, there is one old output (Y0) and one
old input (U0) which we can represent as the states x1 and x2
respectively. If the length of A or B increases, the number of states
will have to be increased accordingly.

So, we have 1 current input (u=U1), one current output (y=Y1) and 2
states (x1=Y0 and x2=U0).

Integration of a discrete state space model (within lsim) is of the form
x(k+1) = A x(k) + B u(k)
y(k+1) = C x(k) + D u(k)

Each time step, u will be updated and y will be evaluated. Additionally,
these values will be placed into the state vector for use in the next
step, so

Y1 = -0.33 Y0 + 0.1 U0 + 0.2 U1
y  = -0.33 x1 + 0.1 x2 + 0.2 u

and, to record the previous values

x1 = y
~   = -0.33 x1 + 0.1 x2 + 0.2 u
x2 = u

Giving the discrete representation:
A = [-0.33 , 0.1 ; 0 , 0 ];
B = [ 0.2  ; 1 ];
C = [-0.33 , 0.1 ];
D = [0.2];

Note that this A matrix is different to the one in my previous reply,
this one is for use in discrete rather than continuous space, so it is
not necessary to do use d2c()

The results of using this in lsim are the same as the original filter:

octave>
U = [1;zeros(9,1)];

AA = [1, 0.33];
BB = [0.2, 0.1];

YF = filter(BB, AA, U);

A = [-0.33 , 0.1 ; 0 , 0 ];
B = [ 0.2  ; 1 ];
C = [-0.33 , 0.1 ];
D = [0.2];

sys = ss2sys(A,B,C,D,1);
[y,x] = lsim(sys, U, [0:9], [0;0]);

YF - y'


ans =

~  0  0  0  0  0  0  0  0  0  0


It should be straightforward to put many such SISO models together to
form a MIMO model. The important thing is to ensure that there are as
many states as previous inputs and outputs.

I hope this is slightly clearer.


- --
Geraint Bevan
http://homepage.ntlworld.com/geraint.bevan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEUEARECAAYFAj+RRkwACgkQcXV3N50QmNPl6gCY/xh2izVWFsU4xAmDIlixiD3T
EwCfSU9/N1wV3Ggklm5wS3GG17MYcHQ=
=rSdL
-----END PGP SIGNATURE-----



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]