d88-tpn@sm.luth.se (Thomas Persson) (03/07/91)
****** 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 -------------------------------------------------------------------------------