필터 지우기
필터 지우기

The length of the initial condition X0 must match the number of states.

조회 수: 9 (최근 30일)
boutros baqain
boutros baqain 2019년 8월 4일
댓글: Johannes James 2021년 3월 14일
hello everyone i cant seem to figure out what the problem with my code. it keeps giving me an error regarding the initial state. any help would be appreciated.
thanks!
here is my code.
A= [0 1 0; 0 0 1; -52 -30 -4];
B = [0;0;1];
C = [20 1 0];
D = [0];
% compute open loop state space
sys_OL = ss(A,B,C,D);
% scaling the B matrix
w = -C/A*B;
% open loop state space with scaled input
sys_OL2 = ss(A, B/w, C, D);
p0 = 5;
Ts = 2;
term = pi^2 +log(p0/100)^2;
zeta = abs(log(p0/100))/sqrt(term);
wn = 4 /Ts/zeta;
beta = sqrt(1-zeta^2);
p3 = 10 * zeta *wn
eigDes = [-zeta*wn+j*wn*beta -zeta*wn-j*wn*beta -p3 -20+i]
% compute the close loop
Ae= [0 1 0 0; 0 0 1 0; -52 -30 -4 0; -20 -1 0 0];
Be = [0;0;1; 0];
Ce = [20 1 0 0];
De = [0];
Br = [0;0;0;1]
Ke = acker(Ae, Be,eigDes) % gain matrix
sys_Cl = ss(Ae - Be*Ke, Br ,Ce,De) %transfer function of close loop
t = 0:0.001:5;
u = ones(size(t));
x0 = [0.01; 0; 0; 0];
x0hat = [0; 0; 0; 0 ];
yOL = lsim(sys_OL2, u, t, x0);
yCl = lsim(sys_Cl, u, t, [x0; x0hat]);
  댓글 수: 4
Johannes James
Johannes James 2021년 3월 14일
It's very bad form to just say "i figured it out" and not exaplin what the solution was. Others coming here following search engine hits, looking for solutions, encounter your useless comment and absence of solution. If you bothered to post, concludet the matter with the solution!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by