Let's say that I have a discrete state space model:
$$x(k+1) = Ax(k) + Bu(k) \\ y(k) = Cx(k) + Du(k)$$
If I want to have this state space model as a balanced model realization. I need to exchange the state vector $x$ to $x = T\xi $. My model will then become.
$$x(k+1) = TAT^{-1}x(k) + TBu(k) \\ y(k) = CT^{-1}x(k) + Du(k)$$
According to my book. Then I need to find the matrix $T$. One good way to find the matrix $T$ is to solve controllability/reachability gramian matrix $P$ and obserability gramian $Q$ from the lyapunov equations:
$$ A^TQA - Q + C^TC = 0$$ $$ APA^T - P + BB^T = 0 $$
Once I have found $P, Q$, I need to find $T$ from the Cholesky factors $Q_1, U, \Sigma_1$.
$$ Q = Q_1^TQ_1 \\ Q_1 P Q_1^T = U \Sigma^2 U^T \\ U^T U = I \\ \Sigma = \Sigma_1^T \Sigma_1 \\ T = \Sigma_1^{-1}U^TQ_1$$
So my question is how I can find the Cholesky factors $\Sigma_1^{-1}U^TQ_1$ if I know $Q, P$? Here I not asking for deep theory. I would be very glad if I got a hint that I can use built in functions from Octave/Matlab.
Edit:
I can use matlab command
Q1 = chol(Q)
To find $Q_1$ or if I use
U = chol(I) % I is the identify matrix of same dimension as P and Q - I assume.
I found $U$. Now it's $\Sigma$ left. If I know $U,Q_1,P $
Can I transform this $$Q_1 P Q_1^T = U \Sigma^2 U^T$$
Into:
$$ [Q_1 P Q_1^TU^{-1}U^{-T}]^{1/2} = \Sigma $$
?
Here is the answer.
Assume we got the discrete state space model:
$$ x(k+1) = Ax(k) + Bu(k) \\ y(k) = Cx(k) $$
We want a balanced realization state space model.
$$ x(k+1) = TAT^{-1}x(k) + TBu(k) \\ y(k) = CT^{-1}x(k) $$
Then we need to find matrix $T $. To find $T$ we need to solve the reachability/controlability matrix $P $ from Lyapunov equation:
$$APA^T - P + BB^T = 0$$
And obserability matrix $Q $ from Lyapunov equation: $$A^TQA - Q + C^TC = 0 $$
Once we have found $P,Q $ we need to find the hankel singular values from $$ \sigma_i = \sqrt{\lambda_i(PQ)} $$
The hankel singular values are square root eigenvalues of product of $PQ$ matrix.
Now we need to find $Q_1, \Sigma_1, U $ matrecies. They are Cholesky factors.
Be begin first with $Q_1$. We can use Matlab or Octave for this.
Then sigma:
$$ \Sigma = diag(\sigma_1, \sigma_2, \sigma_3,....,\sigma_i)$$
And then
At last: $$ T = \Sigma_1^{-1}U^TQ_1$$
Done! Book: System modeling and identification, second edition August 2017, Rolf Johansson, Lund, Sweden. Can be purchased by KFSAB.se because the book is out of print in every store.