solve using MATLAB language only. Newton’s Law of Cooling Newton’s law states th
ID: 3731991 • Letter: S
Question
solve using MATLAB language only.
Newton’s Law of Cooling
Newton’s law states that heats move from objects to its surroundings. The rate of the temperature change is proportional to the temperature difference between the object and its surroundings.
Temperature at time t of the object is equal to :
T(t)=Ts+(T0 Ts)ekt
T(t) = temperature of the object at time t (kelvin) Ts = temperature of the surrounding area (kelvin) T0 = initial temperature of the object (kelvin)
k = cooling constant, specific to the object (1/s)
t = time (s)
• Generate 1000 linearly spaced values of T0 between 200 and 300 Kelvin.
• Get the value of Ts from the user. 5
Get the value of k from the user.
Generate t values between 0 to 10 seconds with increments of 0.1.
Calculate the resulting temperature T(t) for each T0 and t combination using matrix operations, and store this result in a 2D matrix.
Explanation / Answer
Hi,
As per the problem statement, Please find the solution below with in-lined comments as below:
% Implementing the Newton Law of Colling
% Temperature at time t as follows
% Tt = Ts + (T0 - Ts)*e-k*t
clear all;
% Generating the T0 values from in tghe range 200 to 300 as follows
T0 = 200:0.1:300;
Ts = input("Please input the Ts value ");
k = input("Please input the colling constant k value ");
% Generating the t values in the range of 0 to 10 as follows
t=0:0.1:10;
e =0.1;
% Calculating the Tt as follows
resultTempMatrix = zeros(10,100);
% Iteratint over the T0 and t combinition to generate the Ts as follows
for i = 1:10
for j = 1:100
resultTempMatrix(i)(j) = Ts + (T0(j)- Ts).*e-k.*t(i);
end
end
disp("Resultant 2D matrix as follows ");
disp(resultTempMatrix);
output length was too much, please print for your end
Thanks
% Implementing the Newton Law of Colling
% Temperature at time t as follows
% Tt = Ts + (T0 - Ts)*e-k*t
clear all;
% Generating the T0 values from in tghe range 200 to 300 as follows
T0 = 200:0.1:300;
Ts = input("Please input the Ts value ");
k = input("Please input the colling constant k value ");
% Generating the t values in the range of 0 to 10 as follows
t=0:0.1:10;
e =0.1;
% Calculating the Tt as follows
resultTempMatrix = zeros(10,100);
% Iteratint over the T0 and t combinition to generate the Ts as follows
for i = 1:10
for j = 1:100
resultTempMatrix(i)(j) = Ts + (T0(j)- Ts).*e-k.*t(i);
end
end
disp("Resultant 2D matrix as follows ");
disp(resultTempMatrix);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.