Why step respose don't work for first input of a MIMO? And how to use correctly feedback function for pole placement?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi!
I'm trying to make a step response for an unstable MIMO system. When I'm using the step function it's only work for the second input and the first one doesn't to anything. And also, I'm trying to make a feedback control of the system with pole placement, but I don't really know how to write correctly the feedback function. Does anyone know what to do?
The model it's from this study: https://www.mdpi.com/2079-9292/13/3/514#B17-electronics-13-00514
Step response:
Matlab code:
clc
clear all
close all
%% Model parameters
Mp = 0.272;
dM = 0.071;
g = 9.81;
J = 0.002;
Jw = 3.941*10^-5;
b_theta = 0.82*10^-3;
b_altha_kmke_Ra = 1.202*10^-4;
km_Ra = 1.837*10^-4;
%% Matrices for the state space model
A = [0 1 0 0;
(Mp*dM*g)/J -(b_theta)/J 0 1/J*b_altha_kmke_Ra;
0 0 0 1;
-(Mp*g*dM)/J b_theta/J 0 -(J+Jw)/(J*Jw)*b_altha_kmke_Ra];
B = [0 0;
-1/J*km_Ra 1/J;
0 0;
(J+Jw)/(J*Jw)*km_Ra -1/J];
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 1];
D = [0 0; 0 0;0 0;0 0];
%% Build system
sys = ss(A,B,C,0);
step(sys);
Sc = ctrb(sys);
So = obsv(sys);
%% Control
P = [-1;-2;-3;-4]*10;
K = place(A,B,P);
Alc = A-B*K;
sys_cl = ss(Alc,B,C,D);
closeLoop = feedback(sys*Alc,1);
%% Simulation
t = 0:0.001:10;
u = [ones(length(t),1) zeros(length(t),1) zeros(length(t),1) zeros(length(t),1)];
lsim(closeLoop,u,t)
1 件のコメント
Aquatris
2024 年 7 月 1 日
When I'm using the step function it's only work for the second input and the first one doesn't to anything
It actually does, it is just that the magnitude is small compared to the 2nd input response. So use Data Tips in the step response of your open loop system to see the values.
The way you form your closed loop system with feedback is wrong. You have
closeLoop = feedback(sys*Alc,1);
which should be
closeLoop = feedback(sys*K,eye(4));
because you are actually attaching K to your sys not Alc, and you have 4 outputs, so eye(4) for the second argument to the feedback function.
採用された回答
Sam Chak
2024 年 6 月 30 日
You defined the system with 3 outputs; thus you need to feedback 3 outputs as well, not 1 output.
%% Model parameters
Mp = 0.272;
dM = 0.071;
g = 9.81;
J = 0.002;
Jw = 3.941*10^-5;
b_theta = 0.82*10^-3;
b_altha_kmke_Ra = 1.202*10^-4;
km_Ra = 1.837*10^-4;
%% Matrices for the state space model
A = [0 1 0 0;
(Mp*dM*g)/J -(b_theta)/J 0 1/J*b_altha_kmke_Ra;
0 0 0 1;
-(Mp*g*dM)/J b_theta/J 0 -(J+Jw)/(J*Jw)*b_altha_kmke_Ra];
B = [0 0;
-1/J*km_Ra 1/J;
0 0;
(J+Jw)/(J*Jw)*km_Ra -1/J];
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 1];
D = [0 0; 0 0;0 0;0 0];
%% Build system
sys = ss(A,B,C,0);
% step(sys);
Sc = ctrb(sys);
So = obsv(sys);
%% Control
P = [-1;-2;-3;-4]*10;
K = place(A, B, P)
% Alc = A-B*K;
% sys_cl = ss(Alc,B,C,D);
closeLoop = feedback(sys*K, eye(size(A)));
%% Simulation
t = 0:0.001:10;
u = [ones(length(t),1) zeros(length(t),1) zeros(length(t),1) zeros(length(t),1)];
lsim(closeLoop,u,t), grid on
2 件のコメント
Sam Chak
2024 年 6 月 30 日
There are two control inputs on the system. The feedback() command connects and merges the signals so that you only need to specify the reference inputs based on the number of outputs. If you wish to see the step outputs in response to individual step control inputs, then use the step() command.
%% Model parameters
Mp = 0.272;
dM = 0.071;
g = 9.81;
J = 0.002;
Jw = 3.941*10^-5;
b_theta = 0.82*10^-3;
b_altha_kmke_Ra = 1.202*10^-4;
km_Ra = 1.837*10^-4;
%% Matrices for the state space model
A = [0 1 0 0;
(Mp*dM*g)/J -(b_theta)/J 0 1/J*b_altha_kmke_Ra;
0 0 0 1;
-(Mp*g*dM)/J b_theta/J 0 -(J+Jw)/(J*Jw)*b_altha_kmke_Ra];
B = [0 0;
-1/J*km_Ra 1/J;
0 0;
(J+Jw)/(J*Jw)*km_Ra -1/J];
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 1];
D = [0 0; 0 0;0 0;0 0];
%% Build system
sys = ss(A,B,C,0);
% step(sys);
Sc = ctrb(sys);
So = obsv(sys);
%% Control
P = [-1;-2;-3;-4]*10;
K = place(A, B, P)
Alc = A - B*K;
sys_cl = ss(Alc, B, C, D);
%% Simulation
ssr = dcgain(sys_cl)
step(sys_cl), grid on
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!