Unable to perform assignment because the size of the left side is 3-by-1 and the size of the right side is 4-by-1. X(:,1)=Xint is showing the error
1 回表示 (過去 30 日間)
古いコメントを表示
Logeswaran pitchai muthaiyah
2020 年 11 月 25 日
コメント済み: Walter Roberson
2020 年 11 月 25 日
A=[-0.01613 0 0.04348 0; 0 -0.01111 0 0.03333; 0 0 -0.04348 0; 0 0 0 -0.03333];
B=[0.08325 0; 0 0.06281; 0 0.04786; 0.03122 0];
C=[0.5 0 0 0; 0 0.5 0 0; 0 0 0.5 0; 0 0 0 0];
D=zeros(4,2);
t=2000;
T=1:1:t;
Q1=3*ones(t,1);
Q2=3*ones(t,1);
u=[Q1 Q2];
sys=ss(A,B,C,D);
sys_dis=c2d(sys,1);
%y=lsim(sys_dis,u,T);
%plot(y)
Ad=sys_dis.a;
Bd=sys_dis.b;
Cd=sys_dis.c;
Dd=sys_dis.d;
Xint=[0;0;0;0];
X(:,1)=Xint;
for i=1:1:t-1
[ Y(:,i+1), X(:,i+1) ] = output_cal(Ad,Bd,Cd,Dd,(u(i,:))',X(:,i) );
end
0 件のコメント
採用された回答
Walter Roberson
2020 年 11 月 25 日
you have an existing variable named X that is interfering with your code
3 件のコメント
Walter Roberson
2020 年 11 月 25 日
X(:,1)=Xint;
Suppose that at point X already exists and is 3 rows tall, then you would get the error message you are getting.
You are using a script rather than a function, so X could be anything that just happened to be in memory.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!