Controllability Matrix on HP50G and CAS exemples



#2

Unless i'm wrong, there is no integrated command in the 50G to calculate a controllability matrix.

This can be done for example in Matlab with the 'ctrb' command. Here is a general Rpl program to do this :

«
-> a b
«
« a n ^ b * TRN »
'n'
0
a SIZE HEAD 1 -
1
SEQ

« AUGMENT » STREAM TRN
»
»

'Ctrb' STO

This new command works either in exact, approx or symbolic mode.
But perhaps is there another way to do this ?

Here are interesting explanations and exercices about controllability :
http://www.control.utoronto.ca/~broucke/ece557f/Lectures/ch3.pdf

My examples are taken from the prévious link ( University of Toronto) and 3.1.3 case is interesting about the 50G Cas power

(exact mode, Real) :

3.1.1
-----

[[ 0 1 0 0 ]
['-K/M1' 0 'K/M1' 0 ]
[ 0 0 0 1 ]
[ 'K/M2' 0 '-K/M2' 0 ]]

[[ 0 0 ]
['1/M1' 0 ]
[ 0 0 ]
[ 0 '1/M2']]

Ctrb

->

[[ 0 0 '1/M1' 0 0 0 '-(K/M1^2)' 'K/(M2*M1)' ]
[ '1/M1' 0 0 0 '-(K/M1^2)' 'K/(M2*M1)' 0 0 ]
[ 0 0 0 '1/M2' 0 0 'K/(M2*M1)' '-(K/M2^2)' ]
[ 0 '1/M2' 0 0 'K/(M2*M1)' '-(K/M2^2)' 0 0 ]]

RANK

-> 4 @ The system is controllable (Rank = n)

3.1.2
-----

[[0 1 0 0]
['-K/M1' 0 'K/M1' 0]
[ 0 0 0 1]
['K/M2' 0 '-K/M2' 0]
]

[[0]
['-1/M1']
[ 0]
['1/M2']]

Ctrb

->

[[ 0 '-1/M1' 0 '(K*(M1*M1)+K*(M2*M1))/(M2*M1*(M1*M1))' ]
[ '-1/M1' 0 '(K*(M1*M1)+K*(M2*M1))/(M2*M1*(M1*M1))' 0 ]
[ 0 '1/M2' 0 '(-(K*(M1*M2))-K*(M2*M2))/(M2*M2*(M1*M2))' ]
[ '1/M2' 0 '(-(K*(M1*M2))-K*(M2*M2))/(M2*M2*(M1*M2))' 0 ]]

RANK

-> 2 @ The system is not controllable (Rank <> 4)

3.1.3
-----

[[-1 1]
[0 -2]]
'A' STO @ use Matrix writer

[[0] [1]]
'B' STO

A IDN 's' * A - 1/x @ (s.I -A)^(-1)
FACTOR @ Factorise

->

[[ '1/(s+1)' '1/((s+2)*(s+1))' ]
[ 0 '1/(s+2)' ]]

A 't' * << EXP >> DIAGMAP @ e^(At)

->

[[ '1/EXP(t)' '(-EXP(t)+EXP(2*t))/(EXP(2*t)*EXP(t))' ]
[ 0 '1/EXP(2*t)' ]]

'eAt' STO @ or use DUP/ SWAP after

eAt B * B TRN * eAt TRN * @ Wc(t)

->
[[ '(-EXP(t)+EXP(2*t))*(-EXP(t)+EXP(2*t))/(EXP(2*t)*EXP(t)*(EXP(2*t)*EXP(t)))' '(-EXP(t)+EXP(2*t))/(EXP(2*t)*(EXP(2*t)*EXP(t)))' ]
[ '(-EXP(t)+EXP(2*t))/(EXP(2*t)*EXP(t)*EXP(2*t))' '1/(EXP(2*t)*EXP(2*t))' ]]

<< {'t' 'T'} | >> MAP @ change t by T

<< 0 SWAP 't' SWAP 'T' Integrate >> MAP @ (*) integrate = symbol Shift TAN
LIN @ Linearize

->

[[ '1/12+-1/2*EXP(-(2*t))+2/3*EXP(-(3*t))+-1/4*EXP(-(4*t))' 12+-1/3*EXP(-(3*t))+1/4*EXP(-(4*t))' ]
[ '1/12+-1/3*EXP(-(3*t))+1/4*EXP(-(4*t))' '1/4+-1/4*EXP(-(4*t))' ]]

(*) or, if you don't want to use 'blind' stack manipulation :
<< -> f 'Integrate(0,t,f,T)' >> MAP

Edited: 15 Apr 2012, 4:39 p.m.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime: CAS taylor Alberto Candel 5 966 12-13-2013, 09:45 PM
Last Post: Alberto Candel
  HP Prime CAS curiosity bluesun08 11 1,523 12-10-2013, 01:03 PM
Last Post: Han
  [HP-Prime CAS] "Warning, ^ (Command) Is ambiguous on non square matrices"?? CompSystems 1 694 12-07-2013, 07:15 PM
Last Post: CompSystems
  HP Prime: complex numbers in CAS. Alberto Candel 1 565 12-06-2013, 02:36 PM
Last Post: parisse
  AFTER HP-Prime update, Shift+Matrix CRASHES Joseph Ec 3 705 12-06-2013, 11:06 AM
Last Post: Joseph Ec
  [HP Prime] plotfunc() bug in CAS Chris Pem10 2 686 12-04-2013, 02:46 PM
Last Post: Chris Pem10
  HP Prime: Home/CAS? Alasdair McAndrew 11 1,307 11-26-2013, 02:48 PM
Last Post: Alberto Candel
  HP Prime Matrix TERRIBLE bug and question uklo 19 1,879 11-25-2013, 12:10 PM
Last Post: Mic
  HP Prime: editing a matrix Alberto Candel 6 735 11-20-2013, 06:26 PM
Last Post: Helge Gabert
  HP Prime numerical precision in CAS and HOME Javier Goizueta 5 772 11-16-2013, 03:51 AM
Last Post: Paul Dale

Forum Jump: