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 ビュー (過去 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 Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by