(phi,gamma,gamma1) = Matrices.integralExp(A,B); (phi,gamma,gamma1) = Matrices.integralExp(A,B,T=1);
This function computes the exponential phi = e^(AT) of matrix A and the integral gamma = integral(phi*dt)*B and the integral integral((T-t)*exp(A*t)*dt)*B, where A is a square (n,n) matrix and B, gamma, and gamma1 are (n,m) matrices.
The function calculates the matrices phi,gamma,gamma1 through the equation:
[ A B 0 ] [phi gamma gamma1] = [I 0 0]*exp([ 0 0 I ]*T) [ 0 0 0 ]
The matrices define the discretized first-order-hold equivalent of a state-space system:
x(k+1) = phi*x(k) + gamma*u(k) + gamma1/T*(u(k+1) - u(k))
The first-order-hold sampling, also known as ramp-invariant method, gives more smooth control signals as the ZOH equivalent. First-order-hold sampling is, e.g., described in
function integralExpT extends Modelica.Icons.Function; input Real A[:, size(A, 1)]; input Real B[size(A, 1), :]; input Real T = 1; output Real phi[size(A, 1), size(A, 1)] "= exp(A*T)"; output Real gamma[size(A, 1), size(B, 2)] "= integral(phi)*B"; output Real gamma1[size(A, 1), size(B, 2)] "= integral((T-t)*exp(A*t))*B"; end integralExpT;
Release Notes: