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.

2 views (last 30 days)
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

Answers (1)

Image Analyst
Image Analyst on 17 Jun 2019
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 Comment
Omar Andrés Rosada González
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?

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!