function calling in a script
3 ビュー (過去 30 日間)
古いコメントを表示
To solve for friction factor I have a function file to solve colebrook equation, function file to solve derivative of colebrook equation, function file to solve newton raphson using colebrook and its derivative and finally I have a script file where I need to calculate friction factors when the flow is laminar (this part is easy) and when the flow is turbulent where I need to call the newton raphson function and display its answer. This is the part where I'm confused and can't work out. Help please.
function [fd,no]=newton(Cfd,CfD,x,tol,mit) %mit-maximum iterations, tol-tolerance
for no=1:mit
fd=x-Cfd(x)/CfD(x);
err=abs(fd-x);
x=fd;
y=Cfd(x);
if (err<tol)|(relerr<tol)
break
end
end
D=1;
U=1;
rho=1000;
mu=0.0010518;
e=0.003;
Re=rho*U*D/mu;
if Re<2040
fd=64/Re;
else
%how to call the newton raphson function and display its answer???
end
0 件のコメント
回答 (1 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!