iterations while in loop
이전 댓글 표시
having trouble making this iterate for each increment of Vn, it goes straight to Vn = 30, i want it to also to calc a new Re, f, dPloss_1, Va & Q with each new iteration.
D = 0.1; L = 10;
A = 0.25*pi*D^2;
e = 0.0015e-3;
rho = 998;
nu = 1.01e-6;
eoverD = e/D;
alpha = 0.1;
Vo = 2;
for Vn = 2:0.1:30;% iteration length.
%
Re = (Vo.*D) / nu;
%
if Re < 2300
f = 64 / Re;
else
darbyFormula = @(x) 1/sqrt(x)+2*log10(eoverD/3.7 + 2.51/Re/sqrt(x));
f = fzero(darbyFormula,0.01);
end
%
dPloss_1 = (f*rho*(L/D)) * ((Vn*Vo)./2);
Va = (alpha*Vn)+((1-alpha)*Vo);
Q=Va*A;
Vo = Va;
end %
댓글 수: 4
David Sanchez
2013년 8월 27일
what is the problem? Who is D? Do you want to update Re, f, dPloss_1, Va and Q, saving previous values?
harley
2013년 8월 27일
David Sanchez
2013년 8월 27일
but what is the problem?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!