This function computes an triangular matrix from an upper Hessenberg matrix by stepwise annihilation of the subdiagonal elements.
A -> QA = T
It is assumed that the original matrix has upper hessenberg form. Additionally the vector b is transformed in the same way
b -> Qb = q
The function is primarily used to calculate the transfer function gain from a SISO state space system in observer Hessenberg form
( * * ... ... * ) ( * ) ( * * ... ... * ) ( . ) A = ( 0 * ... ... * ), b = ( . ), c = ( 0, ..., 0, * ) ( . . . . . ) ( * ) ( 0 ... 0 * * ) ( * )
If A is upper Hessenberg and T = Q*A is triangular then obviously H(s) = Q*(s*I -A) = s*I - T.
Further on, if T is triangular then also H = sI - T is and the element l_nn of L = inv(H) is given by 1/h_nn. The frequency response G(s0)for a given s0 that is neither zero nor pole of the system can be calculated by
G(s0) = c*(s0*I -A)-1*b = c*(s0*I -A)-1 *Q*Q-1*b = c*(Q-1*(s0*I -A))-1*Q-1*b = c*H-1(s0)*q
and because only the n'th element of c is different to zero the gain k is given by
q_nn*c_nn product(s0 - poles_i) k = ---------- * ---------------------- h_nn product(s0 - zeros_i)
encapsulated function trianUpperHess import Modelica; import Modelica_LinearSystems2.Math.Matrices; import Modelica_LinearSystems2.Math.Vectors; input Real H[:, :] "Upper Hessenberg matrix"; input Real b[size(H, 1)]; output Real Ht[size(H, 1), size(H, 2)]; output Real bt[size(b, 1)]; end trianUpperHess;