Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 2-by-1.

조회 수: 3 (최근 30일)
Hello everyone, could someone help me with the error that I have in the next code?. The problem that I have is related with the title that I indicated before.
m=10; %Número de simulaciones
a=1; %Altura del talud.
hw=1; %Profundidad a la que se encuentra el nivel freático desde la superficie.
g=20; %Peso unitario del suelo
c=10; %Cohesión promedio.
fi=25; %Águlo de cohesión promedio.
b=15; %Ángulo de inclinación del talud.
covc=.3; %Covarianza de la cohesión.
covfi=.1; %Covarianza del tan(fi).
dstdc=covc*c; %Desviación estandard de c'
dstdfi=covfi*tand(fi); %Desviación estandard de tan(fi)
fs=zeros(m,a);
mfs=zeros(m,a);
dfs=zeros(m,a);
for h=1:a
for n=1:m
cfs (n,:)= (c+(-dstdc+(dstdc+dstdc)*rand));
fifs (n,:)= (tand(fi)+(-dstdfi+(dstdfi+dstdfi)*rand));
fs(n,h) = (1./(g*h*sind(b)*cosd(b))).*cfs+(cotd(b)-((9.81*(h-hw))./(g*h*tand(b)))).*fifs;
end
end

답변 (1개)

Image Analyst
Image Analyst 2019년 6월 17일
cfs and fifs are both 2 values, so you're trying to stick two values into one index.
Change the fs line to this and see what you learn:
value = (1./(g*h*sind(b)*cosd(b))).*cfs+(cotd(b)-((9.81*(h-hw))./(g*h*tand(b)))).*fifs
fs(n,h) = value;
  댓글 수: 1
Omar Andrés Rosada González
Omar Andrés Rosada González 2019년 6월 17일
Thank you for the answer.
I tried this but it didn't work. What I pretend is the fs line save the values of each loop, and in the way that you propose me, I can´t do that. Could exist another way of do that?

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

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by