Error using InputOutputModel/feedback (line 137) The first and second arguments of the "feedback" command must have compatible I/O sizes.
25 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Atsushi Ueno
2023 年 5 月 20 日
編集済み: Atsushi Ueno
2023 年 5 月 20 日
> 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 件のコメント
Atsushi Ueno
2023 年 5 月 21 日
But the feedback gain K's input is not "output y" but "state x".
Atsushi Ueno
2023 年 5 月 21 日
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)
参考
カテゴリ
Help Center および File Exchange で スパース状態空間モデル についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!