Solving of two interdependent functions
이전 댓글 표시
Hello! I have a following problem:
I want to write a code where user calculates terminal velocity, but for terminal velocity he must know value of drag coefficient that can be deduced if one knows Reynolds number. But to calculate Reynolds number you need velocity. Now my codes looks like this:
Re1=input(prompt)
while Re1~=Re
if Re1>1000
Cd=0.44
elseif 1<Re1&&Re1<1000
Cd=(24/Re1)*(1+0.15*Re1^0.685)
elseif Re1<1
Cd=24/Re1
end
u=sqrt((8/3)*((ro-1.24)*R*9.8)/(Cd*1.24))
Re=(1.24)*u*2*R/(18*10^-6)
Re1=input(prompt)
end
So as you see in my code user him/herself must guess the value of Reynolds number, but it can take eternity. I want computer to do it. What you can advise?
답변 (1개)
Torsten
2022년 4월 14일
If you solve both of the two equations
u=sqrt((8/3)*((ro-1.24)*R*9.8)/(Cd*1.24))
Re=(1.24)*u*2*R/(18*10^-6)
for u, you get a relation between Re and Cd which is not the relation specified as
if Re>1000
Cd=0.44
elseif 1<Re&&Re<1000
Cd=(24/Re)*(1+0.15*Re^0.685)
elseif Re1<1
Cd=24/Re
end
So one of the three equations you list is superfluous.
댓글 수: 2
Nijat Azimzade
2022년 4월 15일
Torsten
2022년 4월 15일
Even this way you have two unknowns (Re and Cd), since u is unknown too.
This can't be true. Either Re or u must be known.
If Re is known, you can calculate Cd and then u.
If u is known, you can get Cd and iterate for Re.
카테고리
도움말 센터 및 File Exchange에서 Structural Mechanics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!