How to multiply transfer function in matrix form?

32 visualizaciones (últimos 30 días)
Andrew Lee
Andrew Lee el 28 de En. de 2021
Editada: Paul el 28 de En. de 2021
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);

Respuesta aceptada

Andrew Lee
Andrew Lee el 28 de En. de 2021
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);

Más respuestas (1)

Paul
Paul el 28 de En. de 2021
Editada: Paul el 28 de En. de 2021
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.

Categorías

Más información sobre Dynamic System Models en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by