Index exceeds matrix dimensions problem
古いコメントを表示
I am geting '__Index exceeds matrix dimensions_' problem, while running the following function with input:
vanRijn(21,0.0005,0.002,2650,1000,0.2,0.9)
Where can my mistake be?
function [m_b]=vanRijn(T,d_50,d_90,den_s,den_w,R,v_m)
%%step1
nu=0.00000178/(1+0.0337*T+0.000221*T^2);
d_g=d_50*(9.81*(den_s-den_w)/den_w/nu^2)^(1/3);
%%step 2 Shields parameter
if d_g<=4
theta_cr=0.24*d_g^(-1);
elseif d_g>4 && d_g<=10
theta_cr=0.14*d_g^(-0.64);
elseif d_g>10 && d_g<=20
theta_cr=0.04*d_g^(-0.10);
elseif d_g>20 && d_g<=150
theta_cr=0.013*d_g^0.29;
else
theta_cr=0.055;
end
v_cr=sqrt(theta_cr*(den_s-den_w)/den_w*9.81*d_50);
%%step 3 chezy coeficient
C_prime=18*log10(12*R/3/d_90);
%%step 4
v_0_ef=sqrt(9.81)*v_m/C_prime;
%%Step 5
transp=(v_0_ef^2-v_cr^2)/v_cr^2;
%%step 6
m_b=0.053*(transp^2.1)/(d_g^0.3)*den_s*sqrt(9.81*(den_s-den_w)/den_w)*d_50^1.5;
1 件のコメント
Jan
2011 年 10 月 28 日
The complete error message contains the line, which causes the error. Please consider and post such important details.
採用された回答
その他の回答 (1 件)
Fangjun Jiang
2011 年 10 月 28 日
It happens when you try to do this for example.
>> a=rand(2,3)
a =
0.131973292606335 0.956134540229802 0.059779542947156
0.942050590775485 0.575208595078466 0.234779913372406
>> b=a(4,5)
??? Index exceeds matrix dimensions.
Run your code step by step or type in
dbstop if error
and then run your code to find out where it happened and then why it happened.
カテゴリ
ヘルプ センター および File Exchange で Operators and Elementary Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!