Floating Point scalar error while trying to find Grammians

조회 수: 5(최근 30일)
hussain askar
hussain askar 2020년 12월 5일
답변: Shraddha Jain 2020년 12월 22일
This is my code, I'm trying to find the controllability and observability Grammians of the following system where k is unknown. Since i have k, i can't use the function gram(sys,'c'). So i'm trying to use the Grammian equation but i keep getting these errors:
Error using integral (line 85)
A and B must be floating-point scalars.
Error in control (line 15)
Wc = integral(fun,0,T)
Can anyone help me with this please?
syms k tau T
A = [0 1 0; 0 0 1; -6.63*k -171 -101.71];
B = [0;0;6.63*k];
C = [1 0 0];
D = 0;
A_T = A.';
B_T = B.';
C_T = C.';
fun =@(tau) expm(-A*taw).* B .* B_T .* expm(-A_T*taw);
Wc = integral(fun,0,T)
det_Wc = det(Wc)
fun1 = @(tau) expm(A_T*taw) .* C_T .* C .* expm(A*taw);
Wo = integral(fun1,0,T)
det_Wo = det(Wo)


Shraddha Jain
Shraddha Jain 2020년 12월 22일
Hi Hussain,
You are experiencing this error because k is undefined, as a result, A and B are computed as symbolic variables and not matrices as expected by the function expm.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by