Solving of two interdependent functions
Afficher commentaires plus anciens
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?
Réponses (1)
Torsten
le 14 Avr 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 commentaires
Nijat Azimzade
le 15 Avr 2022
Torsten
le 15 Avr 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.
Catégories
En savoir plus sur Structural Mechanics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!