Error using InputOutputModel/feedback (line 137) The first and second arguments of the "feedback" command must have compatible I/O sizes.
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
clear
format compact
M1 = 10; M2 = 1; K = 1000;
% 制御対象 the system without control
A = [0 0 1 0
0 0 0 1
-K/(M1) K/(M1) 0 0
K/(M2) -K/(M2) 0 0];
B=[0
0
1/(M1)
0];
C=[1 0 0 0
0 1 0 0];
sys_ex=ss(A, B, C, 0);
sys_ex.OutputName={'x1','x2'};
% 安定性のチェック check stability
eig(A)
% 可制御性のチェック check controllability
n=size(A,1)
Vc=ctrb(sys_ex)
if(rank(Vc)==n)
disp(' The system is ontrollable')
else
disp(' The system is uncontrollable')
end
% 所望の極の設定 Desired poles
%lambda = [-5, -4]
lambda = [-3-3j, -3+3j, -2-2j, -2+2j]
% 極配置によるゲイン行列を求める pole placement
F = - place(A, B, lambda) % note: switch negative feedback to positive feedback
% 状態フィードバック state feedbak
sys_ex_fdbk = feedback(sys_ex, F, +1);
% ステップ応答 step response
figure(20), clf
step(sys_ex,3);
hold on
step(sys_ex_fdbk,3);
hold off
legend('without control', 'with control')
grid on
3 comentarios
Respuestas (1)
Atsushi Ueno
el 20 de Mayo de 2023
Editada: Atsushi Ueno
el 20 de Mayo de 2023
> please tell me what's wrong in my code
- The feedback part "sys2" does not have to be a state-space model
- The example below specify a state-space model with all zeros, so it affects nothing as feed back loop.
M1=10; M2=1; K=1000;
A = [0 0 1 0; 0 0 0 1; -K/(M1) K/(M1) 0 0; K/(M2) -K/(M2) 0 0];
B = [0; 0; 1/(M1); 0];
C = [1 0 0 0; 0 1 0 0];
sys_ex = ss(A, B, C, 0); % main transfer function
size(sys_ex);
sys_fdbk = ss(zeros(4),zeros(4,2),zeros(1,4),zeros(1,2)); % feedback transfer function
size(sys_fdbk);
sys_ex_fdbk = feedback(sys_ex,sys_fdbk,1);
2 comentarios
Atsushi Ueno
el 21 de Mayo de 2023
But the feedback gain K's input is not "output y" but "state x".
Atsushi Ueno
el 21 de Mayo de 2023
Also, the output from pole function is not dynamic system model but factor. So, you should use ss function again to make whole dynamic system model with feedback again.
M1=10; M2=1; K=1000;
A = [0 0 1 0; 0 0 0 1; -K/(M1) K/(M1) 0 0; K/(M2) -K/(M2) 0 0];
B = [0; 0; 1/(M1); 0];
C = [1 0 0 0; 0 1 0 0];
sys_ex = ss(A, B, C, 0); % main transfer function
lambda = [-3-3j, -3+3j, -2-2j, -2+2j];
F = - place(A, B, lambda); % note: switch negative feedback to positive feedback
sys_ex_fdbk = ss(A+B*F,B,C,0); %feedback(sys_ex, F, +1); % transfer function with the feedback
Pcl = pole(sys_ex_fdbk)
Ver también
Categorías
Más información sobre スパース状態空間モデル en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!