Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

조회 수: 1 (최근 30일)
Here is the arrays i'm using
X=Distancia; % Distancia is 1 x 211 double
Y=Topo; % Topo is 1 x 211 double
lluvia = mms*135900 % lluvia is 211 x 1 double
L = lluvia
Fy=gradient(Y);
FY=sum(Fy)/length(Fy);
Y2=Y;
a=1;
and I want run the follow cycle. Is to calculate Darcy's law for infiltration.
while FY<0
for i=1:length(X)-1
H(i)=Y2(i+1)-Y2(i);
A(i)=H(i)*L;
Fy2(i)=(Y2(i+1)-Y2(i))/(X(i+1)-X(i));
if and(X(i) >= 1, X(i) <= 91) %andosoles
K=1e-4
if and (X(i) > 112, X(i) <= 141) %luvisol
K=1e-10
else
K=1e-8
end
end
Q(i)=A(i).*-K.*Fy2(i);
Y2(i)=Y2(i)-(Q(i)/A(i));
Y2(i+1)=Y2(i+1)+(Q(i)/A(i));
end
Fy3=gradient(Y2)
Y3(:,a)=Y2;
FY=sum(Fy3)/length(Fy3);
a=a+1;
b=floor(a/1000)*1000;
if a==b
plot(X,Y2)
pause(0.02)
end
end
  댓글 수: 5
Marcos Granados Flores
Marcos Granados Flores 2020년 6월 1일
Thank you but keep saying the same error message
"Unable to perform assignment because the indices on the left side are not compatible with the size of the right side"
KSSV
KSSV 2020년 6월 1일
You have not mentioned the line number.
The code runs without any error in my pc. Forget the ouput.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by