How to multiply transfer function in matrix form?

39 ビュー (過去 30 日間)
Andrew Lee
Andrew Lee 2021 年 1 月 28 日
編集済み: Paul 2021 年 1 月 28 日
I want to multiply transfer function in matrix form in order to calculate gain for compensator
which requires to do following calculation:
Dc = - K * (sI - A + BK + LC)^(-1) *L
where K and L are matices designed with pole placement,
A is a matrix for my state space
I is an Identity matrix of a size defined by A
s is frequency domain variable.
My challenge/problem here is that:
Whenever I multiply K matrix with the following matrix
the pole and zero increases as well.
I somehow can't find a way to make 'Dc' into the form of Dc1
Here is my code:
% define A B C for state space
A = [0 1; 0 0];
B = [0 ; 1];
C = [1 0];
% design pole for control
pc = [-0.7071067812+0.7071067812j -0.7071067812-0.7071067812j];
K = place(A,B,pc); %calculate control gain
K = real(K)
% design pole for estimator
% 4 times the frequecy of controller
% but not to large to decrease bandwith for noise
pe = [-2.5+4.330127019j -2.5-4.330127019j];
Lt = place(A',C',pe); %calculate estimator gain
L = Lt'
% define s and I before calculate overall gain
s = tf('s');
[row, column] = size(A)
I = eye(row)
sI = s*I
INV = sI-A+B*K+L*C
X = INV\L
Dc = -mtimes(K,X)
Dc1=-40.4*(s+0.619)/(s+3.21+4.77j)/(s+3.21-4.77j)
rlocus(Dc);
bode(Dc);
margin(Dc);

採用された回答

Andrew Lee
Andrew Lee 2021 年 1 月 28 日
just found a way to solve this, but " .*" seem to caue error message
Full code below:
% define A B C for state space
A = [0 1; 0 0];
B = [0 ; 1];
C = [1 0];
% design pole for control
pc = [-0.7071067812+0.7071067812j -0.7071067812-0.7071067812j];
K = place(A,B,pc); %calculate control gain
K = real(K)
% design pole for estimator
% 4 times the frequecy of controller
% but not to large to decrease bandwith for noise
pe = [-2.5+4.330127019j -2.5-4.330127019j];
Lt = place(A',C',pe); %calculate estimator gain
L = Lt'
% define s and I before calculate overall gain
s = tf('s');
[row, column] = size(A)
I = eye(row)
sI = s*I
INV = sI-A+B*K+L*C
X = INV\L
Dc = tf('s')
Dc = 0*Dc
for i = 1:row
Dc = Dc + K(1:i).*X(i:1)
end
Dc
Dc1=-40.4*(s+0.619)/(s+3.21+4.77j)/(s+3.21-4.77j)
rlocus(Dc);
bode(Dc);
margin(Dc);

その他の回答 (1 件)

Paul
Paul 2021 年 1 月 28 日
編集済み: Paul 2021 年 1 月 28 日
The result you seek can be found by (after running the code in the original question):
>> minreal(Dc)
ans =
-40.36 s - 25
---------------------
s^2 + 6.414 s + 33.07
Continuous-time transfer function.
The transfer function algebra in the code is introducing artificial poles and zeros. There is probably a better way solve the whole problem from the start. Such as:
> tf(ss(A-B*K-L*C,L,-K,0))
ans =
-40.36 s - 25
---------------------
s^2 + 6.414 s + 33.07
Continuous-time transfer function.

カテゴリ

Help Center および File ExchangeDynamic System Models についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by