Integral of controllability gramian
Mostra commenti meno recenti
I am having trouble finding a way to integrate the controllability gramian in Matlab. My system is unstable so I can't use the built in function. My system also has eigenvalues on the imaginary axis so I can't use a function I found online for unstable systems. So i'm trying to integrate the controllability gramian for some finite time interval on MATLAB, but it seems impossible. Here's what the integral looks like.

Where A is a 6x6 matrix and B is a 6x1 matrix. The matrix exponential in the equation is what's causing me the most trouble.
Any ideas?
Risposta accettata
Più risposte (4)
Sheng Cheng
il 16 Feb 2017
Modificato: Sheng Cheng
il 20 Feb 2017
I have a different way for computing the controllability gramian matrix based on an early paper, 'Computing integrals involving the matrix exponential', by Charles Van Loan. The paper can be found here: https://www.cs.cornell.edu/cv/ResearchPDF/computing.integrals.involving.Matrix.Exp.pdf
I will skip the mathematical rigorous proof in the paper. In fact, all the result you need to compute the gramian matrix is written in the left column on the first page. Especially, equation (1.2) is the form we are looking for. (Please read the paper for the extremely simple structure of this integral (actually the controllability gramian is indeed an integral involving matrix exponential)).
The code is just in two lines
A = rand(6); % Create Data
B = rand(6, 1); % Create Data
temp = expm([-A B*B';zeros(6,6) A']); % Coming from the first equation below (1.4)
Wc = temp(7:12,7:12)'*temp(1:6,7:12); % Coming from the second equation below (1.4)
Here, you don't need to define a function and an integral like the one suggested by Star Strider. All you need is expm and then some very simple matrix operation.
5 Commenti
Star Strider
il 16 Feb 2017
Interesting. Noted.
Thank you.
Sheng Cheng
il 20 Feb 2017
You are welcome!
Star Strider
il 20 Feb 2017
In all my control courses, I never encountered that. The paper you attached is in my collection.
+1 Vote!
Meena Farag
il 12 Ott 2021
Martín
il 21 Lug 2025
Just read this and I had to comment this is a beatuful way to solve the problem.
Ahmed Rashid
il 31 Mag 2016
Why don't you check the rank of the controllability matrix?
C = rank([B AB A^2B ... A^(n-1)*B])
If C has full rank, then the system is controllable.
4 Commenti
Meena Farag
il 31 Mag 2016
Ahmed Rashid
il 31 Mag 2016
Calculating the integral is equivalent to calculating the Lyapunov equation.
A*W+W*A^T+B*B^T=0
So you can find it by solving the above system of equations in Matlab.
Meena Farag
il 1 Giu 2016
Bryan Jevon
il 30 Ott 2018
May you help me with source or literature that provide information about how weak rank test by using controllability and observability matrix?
Roger Stafford
il 1 Giu 2016
0 voti
In matlab there is a very important difference between e.^((A.’)*τ) and e^((A.’)*τ) (without the dot.) The first of these is an element-wise exponentiation and the second a matrix exponentiation. If you use exp((A.’)*τ), it will produce the element-wise version. I rather suspect you want the element-wise version.
2 Commenti
Meena Farag
il 1 Giu 2016
Star Strider
il 1 Giu 2016
Actually, I looked this up in my control reference (and Wikipedia Controllability Gramian). It’s matrix exponentiation, expm.
Rajani Metri
il 1 Dic 2018
0 voti
How to calculate Minimum control u*(t) required to state transfer from x1(t) to x2(t) and from it the states x1*(t) and x2(*)? also how to Plot them?
Thank you
1 Commento
Star Strider
il 1 Dic 2018
Post this as a new Question.
No one will respond to it here.
Categorie
Scopri di più su Matrix Computations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!