Error using + Matrix dimensions must agree. Pleasee Helppp
3 ビュー (過去 30 日間)
古いコメントを表示
if true
% code
endRelRough = [0.00001 0.00005 0.0001 0.0002 0.0004 0.0006 0.0008 0.001 0.002 0.004 0.006 0.008 0.01 0.015 0.02 0.03 0.04 0.05];
ReL = [600:100:3900];
FCL = 64./ReL;
ReT = [[4e3:1e3:9e3] [1e4:1e4:9e4] [1e5:1e5:9e5] [1e6:1e6:9e6] [1e7:1e7:1e8]];
for i=1:length(RelRough)
for j=length(ReT)
FCT_old=1;
residual=1;
while residual>0
FCT_new=1./(-2*log10((RelRough./3.7)+(2.51./(ReT*sqrt(FCT_old))))).^2 ;
residual=abs(FCT_new-FCT_old);
FCT_old=FCT_new
end
FCT(i,j)=FCT_old
end
end
>> FCLT_kimhaote Error using + Matrix dimensions must agree.
Error in FCLT_kimhaote (line 10) FCT_new=1./(-2*log10((RelRough./3.7)+(2.51./(ReT*sqrt(FCT_old))))).^2 ;
0 件のコメント
回答 (1 件)
James Tursa
2017 年 11 月 14 日
The error message is very clear. The variables you are trying to add do not have compatible sizes. Specifically
>> size(RelRough)
ans =
1 18
>> size(ReT)
ans =
1 43
>> FCT_new=1./(-2*log10((RelRough./3.7)+(2.51./(ReT*sqrt(FCT_old))))).^2 ;
??? Error using ==> plus
Matrix dimensions must agree.
You need to fix your code so that the operation is compatible.
3 件のコメント
Adam
2017 年 11 月 14 日
Clearly you haven't if you are getting different sized matrices to add together!
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

