Using equation inside loop to and determining how much it has cooled over a period of time
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all
I am currently writing a script where i am measuring the cooling of a coke in a freezer.
I am using the a mnipulation of specific heat equation.
Ti+1 = Ti + K * delta(t) * (F-Ti)
Temp of coke is 20 degrees C
Temp of freezer is -2 degrees C
Ti +1 = cooling changes of substance
Ti = itnial temp of substance
K = conduction coeff
F = temp of freezer
consider K = 0.20 and delta(t) = 2
how can i work out the cooling of this over ( 200 number of minutes) and see the point where the bottle becomes less than 0 degrees C?
Should also display 'substance took ... minutes to reach 0 degrees C'
Thank you in advance, still trying to work this program out.
0 commentaires
Réponses (1)
Image Analyst
le 15 Août 2021
You can either use a for loop
for t = 2 : 200
T(t) = T(t-1) + K * deltat * (F-T(t-1))
% Quit once it drops below 0
if T(t) < 0
break
end
end
Or use a while loop
maxIterations = 200
T(1) = initialTemperature
loopCounter = 1
while loopCounter < maxIterations && T(loopCounter) > 0
loopCounter = loopCounter + 1;
T(loopCounter) = .....whatever
end
1 commentaire
Image Analyst
le 16 Août 2021
Modifié(e) : Image Analyst
le 16 Août 2021
Ben, did my hints work for you? I have not heard back from you yet.
Voir également
Catégories
En savoir plus sur Mathematics and Optimization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!