Question
%x(1)=diameter %x(2)=velocity %x(3)=Reynolds Number %x(4)=friction F =[x(2)-0.35/(3.14*x(1)*x(1)/4); x(3)-x(2)*x(1)/(1.655*10^(-5)); 1/sqrt(x(4))+2.0*log10(2.51/(x(3)*sqrt(x(4)))); x(4)-20*x(1)*2*9.81/(150*x(2)*x(2))]; options=optimset('tolx',1e-18,'maxfunevals',4000000,'tolfun',1e-18,'maxiter',200000) [x,fval] = fsolve('turbfriction',[0.1 0.1 100000 0.1 ],options) function F=turbfriction(x) %x(1)=diameter %x(2)=velocity %x(3)=Reynolds Number %x(4)=friction
%x(1)=diameter %x(2)=velocity %x(3)=Reynolds Number %x(4)=friction F =[x(2)-0.35/(3.14*x(1)*x(1)/4); x(3)-x(2)*x(1)/(1.655*10^(-5)); 1/sqrt(x(4))+2.0*log10(2.51/(x(3)*sqrt(x(4)))); x(4)-20*x(1)*2*9.81/(150*x(2)*x(2))]; options=optimset('tolx',1e-18,'maxfunevals',4000000,'tolfun',1e-18,'maxiter',200000) [x,fval] = fsolve('turbfriction',[0.1 0.1 100000 0.1 ],options) function F=turbfriction(x) %x(1)=diameter %x(2)=velocity %x(3)=Reynolds Number %x(4)=friction F=[x(2)-0.35/(3.14*x(1)*x(1)/4); x(3)-x(2)*x(1)/(1.655*10^(-5)); 1/sqrt(x(4))+2.0*log10(2.51/(x(3)*sqrt(x(4)))); x(4)-20*x(1)*2*9.81/(150*x(2)*x(2))]; but get error like this: error: x(2): out of bound 1 (dimensions are 1x1) error: called from turbfriction at line 8 column 2
can u solve the error and write correct code? mathlab-octave
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started