Any help would be much appreciated as i feel i have exhausted my knowledge
Write a script to determine the change in temperature of the liquid over a 200 minute time period using the following equation: T(i+1)=T(i)+K*(Delta_t)*(F-T(i))
10 ビュー (過去 30 日間)
古いコメントを表示
The start Temperature of a liquid is 50 and is placed into a fridge of temperatue 5. (F=5)
Have to calculate each value of T(i+1) from the value of ܶT(i) from the previous time step over a space of 200 minutes where the time in dived into time steps each of duration delta_t. Must be computed using a 'For' loop. Also K = 0.045
I cant seem to get the time incrments correct as i always get negative values for my temperature which doesnt make any sense realistically.
clear all
clc
F=5
K=0.045
for x=200:-20:0
T=50:-5:5
T_final=T+K*x*(F-T)
end
plot(x,T_final)
回答 (1 件)
William Rose
2022 年 10 月 26 日
The change in temperature in each time step is proportional to the difference bwteeen the current temp and the fridge temp (Tf=5, constant):
deltaT = K*(T-Tf)*deltat
where deltaT is the change in temp (it changes with each time step) and deltat is the time step size (constant). I have assumed that K is a "rate of decay" constant, with units of 1/time.
You get negative values because you assume the temperature just declines at a constant rate, instead of assuming that it decays at a rate proportional to the difference between current tmp and fridge temp.
You can put that idea into a Matlab script.
By the way, this problem also has an analytical solution, involving an exponential function:
T(t)=(Tinit-Tf)*exp(-Kt) + Tf
If you plug in t=0 and t=infinity, you see that T(0)=Tinit=50 and T(infinity)=Tf=5, which makes sense.
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Graphics Object Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!