**Temperature Dynamics**

The temperature of coffee cooling in a porcelain mug at room temperature (68°F) was measured at various times. The data follows.

Develop a model of the coffee’s temperature as a function of time and use the model to estimate how long it will take the temperature to reach 120°F.

•** Solution**

Because T(O) is finite but nonzero, the power function cannot describe this data, so we do not bother to plot the data on log-log axes. Common sense tells us that the coffee will cool and its temperature will eventually equal the roolT!temperature. So we subtract the room temperature from the d ta and plot

the relative temperature, T – 68, versus time. If the relative temperature is a Ii ear function of time, the model is

Figure 5.5-5 shows the plots used to solve the problem, The following MATLAB script file generates the top two plots. The time data is entered in the array time, and the temperature data is entered in temp. % Enter the data. time = [0,620,2266,3482); temp = [145,130,103,90); %Subtract the room temperature. temp = temp – 68; % Plot the data on rectilinear scales. subplot(2,2,1)

plot(time, temp, time, temp, ‘o’),x label (‘Time (see) ‘)

y label(‘Relative Temperature (deg F) ‘) f;

f; Plot the data on semilog scales. subplot(2,2,2) .

semilogy(time, temp, time, temp, ‘o’j , x label(‘Time (see) ‘), …

y label(‘Relative Temperature (deg F) ‘) The data forms a straight line on the semi log plot only (the top right plot). Thus it can

be described with the exponential function T = 68 + b (10)I1 II. Using the poly fit command, the following lines can be added to the script file. % Fit a straight line to the transform~d data.

p poly fit(time,log10 (temp),l); :1 p (1) b 10 p(2)

The computed values are 111 =- I .5557 X 10-4 and b=77.4469. Thus our derived model is T = 68 +b( I0)’11/.To estimate how long it will take for the coffee to cool to 1200 F, we must solve the equation 120 = 68 +b( 10)”” for t. The solution is t = [(log 10(120 – 68) –

log 10 b)]/m. The MATLAB command for this calculation is shown in the following script file, which is a continuation of the previous script and produces the bottom two subplots shown in Figure 5.5-5.

% Compute the time to reach 120 degrees.

t_120 = (log10(120-68)-log10(b) )/m

% Show the derived curve·and estimated point on semilog scales.

t = [0:10:4000];

T = 68+b*10.A(m*t);

subplot(2,2,3) semi logy (t,T-68, time, temp, ‘0’ ,t_1.20,120-68, ‘+’ )r

x label (‘Time (see)’) y label(‘Relative Temperature (deg F) ‘) %

% show the derived curve and estimated point on rectilinear scales.

subplot(2,2,4) plot( t ,T, time, temp+68, ‘0’ , t_120, 120, ‘+’),x label (‘Time (see)’) y label(‘Temperature (deg F) ‘) The computed value of t_12 0 is 1112. Thus the time to reach 1200 F is 1112 sec. The

plot of the model, along with the data and the estimated point (II 12, 120) marked with a + sign, is shown in the bottom two subplots in Figure 5.5-5. Because the graph a our model lies near the data points, we can treat its prediction of 1112 see with some

confidence.