Floating Point scalar error while trying to find Grammians

1 ビュー (過去 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)

回答 (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.

カテゴリ

Find more on Matrix Computations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by