solve using MATLAB language only. Newton’s Law of Cooling Newton’s law states th
ID: 3900235 • 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)?e?kt 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
Please give thumbs up, and for any querry, please comment, thanks
CODE :
%take input ts from user
ts=input('Enter temperature of the surrounding area (kelvin) :');
%take input k from user
k=input('Enter the value of k : ');
%generate 100 sample of T0 from 200 to 300
T0=linspace(200,300,1000);
%generate t from 0 to 10 with increment 0.1
t=0:0.1:10;
%for each T0
for i=1:length(T0)
%for each t
for j=1:length(t)
%store in 2D matrix, T is that 2d matrix
T(i,j)=ts+(T0(i)-ts)*expm(-k*t(j));
end
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.