Using MATLAB. The change of temperature for an object placed in an isothermal ch
ID: 3770138 • Letter: U
Question
Using MATLAB. The change of temperature for an object placed in an isothermal chamber may be modeled by the formula
T = Ts + (To – Ts)e-kt
where T is the temperature of the object at time t, Ts is the temperature of the isothermal chamber, To is the temperature of the object at time t = 0, and k is a rate constant. Suppose a can of soda was removed from a refrigerator at a temperature of 38 degrees and placed in a car sitting in the sun that maintains an interior temperature of 125 degrees. Calculate the temperature of the can of soda from 0 to 3 hours in increments of 0.1 hours to the nearest integer if k is 0.40. Define all the variables then calculate the temperatures. Create a table (do not use table command) with T in the first column and t in in the second problem.
Explanation / Answer
function [T tarr] = printTempTable(Ts, To, k)
count = 1
T = []
tarr = []
for t = 0: 0.1: 3
% T = Ts + (To – Ts)e-kt
T(count) = Ts + (To - Ts) * exp(-1 * k *t)
tarr(count) = t
count = count+1
end
end
[T t] =printTempTable(125, 38, 0.40)
disp("T t")
for i = 1 : length(T)
fprintf("%f %f ",T(i), t(i))
end
----------------output-----------------