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.

1 Ansicht (letzte 30 Tage)
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

Antworten (1)

Image Analyst
Image Analyst am 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 Kommentar
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?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Particle & Nuclear Physics finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by