Assignment has more non-singleton rhs dimensions than non-singleton subscripts ERROR IN FOR LOOP

조회 수: 1 (최근 30일)
hi every one
I have written this code But the error is showen
clear,clc
N = 5;
A = eye(6);
B = zeros(6,3);
u = zeros(3,N)
x = zeros(6,N); x(:,1)=[1;1;1;1;1;1];
for i=1:N
x(:,i+1)=x(:,i)+A*x(:,i)+B*u(i);
end
Assignment has more non-singleton rhs dimensions than non-singleton subscripts

채택된 답변

James Tursa
James Tursa 2021년 1월 16일
편집: James Tursa 2021년 1월 16일
x(:,i+1)=x(:,i)+A*x(:,i)+B*u(:,i); % changed u(i) to u(:,i)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by