필터 지우기
필터 지우기

Problem in observibility and controlibility function ctrbf,obsvf

조회 수: 3 (최근 30일)
After doing similarity transform, transfer function of a system taking controllable modes should be same as original. But it is not showing same results.
>> clear >> A = [-.5 1 0;-1 -.5 0; 0 1 0]
A =
-0.5000 1.0000 0
-1.0000 -0.5000 0
0 1.0000 0
>> b=[1;2;0]
b =
1
2
0
>> c =[0 0 1]
c =
0 0 1
>> [Abar,Bbar,Cbar,T,k]=ctrbf(A,b,c)
Abar =
0 0 0
0.4472 -0.5000 1.3416
0.6667 -0.7454 -0.5000
Bbar =
0
0.0000
2.2361
Cbar =
0.7454 0.6667 0
T =
-0.5963 0.2981 0.7454
0.6667 -0.3333 0.6667
0.4472 0.8944 0
k =
1 1 0
>> c*inv([s 0 0;0 s 0;0 0 s]-A)*b ??? Undefined function or variable 's'.
>> s=sym('s'); >> c*inv([s 0 0;0 s 0;0 0 s]-A)*b
ans =
(2*(4*s + 2))/(s*(4*s^2 + 4*s + 5)) - 4/(s*(4*s^2 + 4*s + 5))
>> Cbar*inv([s 0 0;0 s 0;0 0 s]-Abar)*Bbar
ans =
(4*s + 2)/(13510798882111488*(4*s^2 + 4*s + 5)) + 40/(20*s^2 + 20*s + 25)
>> T*A*T'
ans =
0 0 0
0.4472 -0.5000 1.3416
0.6667 -0.7454 -0.5000
>> Ac=[Abar(2,2) Abar(2,3);Abar(3,2) Abar(3,3)]
Ac =
-0.5000 1.3416
-0.7454 -0.5000
>> Bc=[Bbar(2,1);Bbar(2,3)] ??? Attempted to access Bbar(2,3); index out of bounds because size(Bbar)=[3,1].
>> Bc=[Bbar(2,1);Bbar(3,1)]
Bc =
0.0000
2.2361
>> Cc=[Cbar(1,2);Cbar(1,3)]
Cc =
0.6667
0
>> Cc=[Cbar(1,2) Cbar(1,3)]
Cc =
0.6667 0
>> Cc*inv([s 0 ;0 s]-Ac)*Bc
ans =
(4*s + 2)/(13510798882111488*(4*s^2 + 4*s + 5)) + 8/(4*s^2 + 4*s + 5)
>>
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 3월 27일
It would be easier on readers if you were to cut out the places you know you made mistakes.

댓글을 달려면 로그인하십시오.

채택된 답변

Teja Muppirala
Teja Muppirala 2011년 3월 28일
This difference is just from round-off errors. Notice the second element in Bbar is 1.1102e-016. That is why you get that very large denominator (13510798882111488) in the symbolic expression
say Bbar(2) = 0, then everything works fine.
A = [-.5 1 0;-1 -.5 0; 0 1 0];
b=[1;2;0];
c =[0 0 1];
[Abar,Bbar,Cbar,T,k]=ctrbf(A,b,c)
syms s
Bbar(2) = 0;
c*( (s*eye(3)-A) \b)
Cbar*( (s*eye(3)-Abar) \Bbar)

추가 답변 (1개)

Teja Muppirala
Teja Muppirala 2011년 3월 28일
Just a suggestion, but when doing symbolic calculations using 's' as a transfer function variable, you might want to explicitly make s a transfer function instead of just an ordinary symbolic variable.
s = tf('s')
instead of
s = sym('s')
This will allow you to actually treat those expressions like transfer functions.
G1 = c*( (s*eye(3)-A) \b) G2 = Cbar*( (s*eye(3)-Abar) \Bbar)
bode(G1) etc...
There is also a function MINREAL that you can use to cancel out poles and zeros.
minreal(G1,1e-6)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by