Error using + Matrix dimensions must agree. Pleasee Helppp
Mostrar comentarios más antiguos
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 ;
Respuestas (1)
James Tursa
el 14 de Nov. de 2017
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 comentarios
Kim Hao Teong
el 14 de Nov. de 2017
Editada: Kim Hao Teong
el 14 de Nov. de 2017
Adam
el 14 de Nov. de 2017
Clearly you haven't if you are getting different sized matrices to add together!
Kim Hao Teong
el 14 de Nov. de 2017
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

