Floating Point scalar error while trying to find Grammians

1 次查看(过去 30 天)
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)

回答(1 个)

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.

类别

Help CenterFile Exchange 中查找有关 Robust Control Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by