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!