Article 4829 of comp.sys.handhelds:
Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!news.cs.indiana.edu!know!zaphod.mps.ohio-state.edu!swrinde!ucsd!ucbvax!bloom-beacon!eru!hagbard!lunic!my!luth!d88-tpn
From: d88-tpn@sm.luth.se (Thomas Persson)
Newsgroups: comp.sys.handhelds
Subject: This is a controllprogram for the HP48sx.
Message-ID: <1497@tau.sm.luth.se>
Date: 6 Mar 91 18:06:15 GMT
Reply-To: Thomas Persson <d88-tpn@sm.luth.se>
Organization: University of Lulea, Sweden
Lines: 102
UUCP-Path: {uunet,mcvax}!sunic!sm.luth.se!d88-tpn


		     ****** THIS IS A HP48 PROGRAM *****


	Hi folks.

	This is a program for control-people. It takes a discrete system
	on the form:

		x[k+1]=A*x[k]+B*u[k]	(1)

		y[k]=C*x[k]		(2)

	and calculates the respons of the system from any vector u.

	Ex: Considering the system

		A:[[1 .5
		    0 .5]]

		B:[1 .5]

		C:[[0 1]]

		Inital values x1=0 and x2=0 at discretetime t=0

		u:[1111111111111111111111111] (Step signal)

	Put it on the stack in the following way...

	Stack diagram:

		5: [[1 .5] [0 .5]]	(A)
		4: [1 .5]		(B or 'gamma')
		3: [[0 1]]		(C)
		2: [0 0]		(x1 x2)
		1: [111111111111]	(u)

	And then press 'SIMUL' in the 'CST' menu.

	After a time you vill get ...

	Stack diagram:

		4:
		3:
		2:
		1:

	Then goto the 'STAT' menu and use 'SCATTERPLOT' to plot the
	response of the system. Voila!

	As always, I'M NOT responsible for any damages this program vill
	cause anyone. So if you for an example, use this program to design
	a controllprogram for the spaceshuttle, and it blows to pieces
	because of that. Then I'm NOT responsible for that accident!

	I have the copyright for this program, but feel free to copy this
	program. I don't mind at all as long as you keep this messages in
	the file.

	If you wan't to contact me for some reason, my adress is:

		Thomas Persson
		Porsogarden 32:291
		951 65 LULEA
		SWEDEN
		Phone: +46 92016449
		Email: d88-tpn@sm.luth.se

	And here's the program...

-----XXX CUT HERE XXX-----
%%HP: T(3)A(R)F(.);
DIR
  CST { SIMULATE }
  SIMULATE
    \<< \-> \GW \Gl C XK U
      \<< CL\GS 0 C XK
* OBJ\-> DROP { 2 }
\->ARRY \GS+ 1 U SIZE
EVAL
        FOR K K \GW
XK * \Gl U K GET * +
'XK' STO C XK *
OBJ\-> DROP { 2 }
\->ARRY \GS+
        NEXT
      \>>
    \>>
  GETROW
    \<< \-> M C
      \<< 1 M SIZE 1
GET
        FOR X M X C
2 \->LIST GET
        NEXT M SIZE
1 GET 1 \->LIST \->ARRY
      \>>
    \>>
END
-------------------------------------------------------------------------------


