Size mismatch (size [1 x 11] ~= size [1 x 10]).

13 ビュー (過去 30 日間)
jose luis huayanay villar
jose luis huayanay villar 2020 年 7 月 3 日
編集済み: Walter Roberson 2020 年 7 月 9 日
Greetings to al my name JOSE LUIS HUAYNAY VILLAR, I have the following error problem;
Size mismatch (size [1 x 11] ~= size [1 x 10]).
the program indicates the error to me in this line, that seems strange to me
Function 'MATLAB Function3' (#169.624.635), line 21, column 17: "D(k+1)+D(j)" Launch diagnostic report.
and this is my code, please someone help me:
function dot_theta = fcn(theta,theta_0,theta_f)
dot_theta=size(10,1);
D=size(10,1);
K=size(10,1);
L=50; %comprimento
z=linspace(0,L,10);
theta_r = 0.218;
alpha= 0.0115;
K_s = 31.6;
theta_s=0.52;
dz=L/length(z);
b=1/(2*dz^2);
n = 2.03;
m=1-(1/n);
i=2:length(z),
j=1:length(z),
k=0:length(z),
D=(K_s*(1-m)/(alpha*m*(theta_s-theta_r)))*dot(theta,theta);
K=(K_s*(1-m)/(alpha*m*(theta_s-theta_r)))*dot(theta,theta);
dot_theta =b*((D(k+1)+D(j))*(theta(k+1)-theta(j))- b*(D(i-1)+D(j))*(theta(j)-theta(i-1))+((K(j)-K(i-1))/Delta_z));

採用された回答

Walter Roberson
Walter Roberson 2020 年 7 月 3 日
i=2:length(z),
That is 2:10
j=1:length(z),
That is 1:10, which is one element longer than i.
D(i-1)+D(j)
D(i-1) becomes D(1 to length(z)-1) which is D(1 : 9)
D(j) is D(1:length(z)) which is D(1:10)
The two items are different lengths and cannot be subtracted.
You have similar problems for theta(k+1) vs theta(j)
  9 件のコメント
jose luis huayanay villar
jose luis huayanay villar 2020 年 7 月 9 日
編集済み: Walter Roberson 2020 年 7 月 9 日
function D = fcn(theta)
L=1; %comprimento
z=linspace(0,L,100); % espaco de discretizacao
theta_r = 0.218; % conteudo de agua residual
alpha= 0.0115; %parametro de Van Genuchten 1/cm (Van Genuchten, 1980)
K_s = 31.6; % conductividade de saturacao cm/t
theta_s=0.52; %conteudo de agua saturado
n = 2.03;
m=1-(1/n);
i=max([1 0 2])+1:length(z),
D =(K_s*(1-m)/(alpha*m*(theta_s-theta_r)))*(theta(i-2).^(0.5-(1/m))./(1-(theta(i-2).^(1/m)))).*((1-(1-(theta(i-2).^(1/m))).^m).^2);
jose luis huayanay villar
jose luis huayanay villar 2020 年 7 月 9 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

タグ

製品


リリース

R13SP1

Community Treasure Hunt

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

Start Hunting!

Translated by