Why step respose don't work for first input of a MIMO? And how to use correctly feedback function for pole placement?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Andrei Rotaru
el 30 de Jun. de 2024
Comentada: Aquatris
el 1 de Jul. de 2024
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 comentario
Aquatris
el 1 de Jul. de 2024
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.
Respuesta aceptada
Sam Chak
el 30 de Jun. de 2024
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 comentarios
Sam Chak
el 30 de Jun. de 2024
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
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!