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?

Respuestas (1)

Torsten
Torsten el 14 de Abr. de 2022
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 comentarios

Nijat Azimzade
Nijat Azimzade el 15 de Abr. de 2022
Even this way you have two unknowns (Re and Cd), since u is unknown too.
Normally, solution of this problem must be as following. 1. You assume Re (e.g. =1001). 2. You pick corresponding Cd value (in this case it is 0.44). 3. You calculate u with this Cd value. 4. With u you calculate Reynolds number. If your Reynolds number is equal to your initial assumption, then this assumption was correct
Torsten
Torsten el 15 de Abr. de 2022
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.

Iniciar sesión para comentar.

Preguntada:

el 14 de Abr. de 2022

Comentada:

el 15 de Abr. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by