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?
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
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
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)
K = 2x4
171.9502 12.9000 171.2903 12.1887 1.3313 0.1020 0.5386 0.0226
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
% 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 个评论
Andrei Rotaru
Andrei Rotaru 2024-6-30
That's great! I didn't know that i was using only 1 output. Thanks a lot!
And for the step signal that shows only input 2? Do you know anything about that?
Sam Chak
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)
K = 2x4
171.9502 12.9000 171.2903 12.1887 1.3313 0.1020 0.5386 0.0226
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Alc = A - B*K;
sys_cl = ss(Alc, B, C, D);
%% Simulation
ssr = dcgain(sys_cl)
ssr = 4x2
-0.0052 1.6634 0 0 0.0111 -1.6698 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
step(sys_cl), grid on

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by