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.