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!