MatLab codes for the used by forensics to determine the exact time of death.

4 visualizaciones (últimos 30 días)
Hello:
Please help me write MatLab codes for the solution of the model used by forensics to determine the exact time of death derived from Newton's law of cooling given that T(t)= 70+10e^kt and T(0)=80. I need it for my project and am not so familiar with MATLAB
Those are the only informations i was given
Here I was trying but i do not really have a clue on how to continue
clc; clear ; close all;
%T(t)=70+10e^kt T(0)=80
F = @(t,T(t)) 70+10*exp(k*t);
T_0 = 80;
plot(t,T_0)
Thank you for your help.

Respuesta aceptada

Davide Masiello
Davide Masiello el 11 de Oct. de 2022
Editada: Davide Masiello el 13 de Oct. de 2022
if you already have an expression for T, why would you solve the ODE?
anyways, the correct syntax is
clear,clc
k = 0.5
k = 0.5000
F = @(t,T) k*(70-T);
tspan = [0 5];
T0 = 80;
[t,T] = ode45(F,tspan,T0);
plot(t,T)
legend('k = 0.5')
You could even solve it analytically
syms t T(t) k
eqn = diff(T,t) == k*(70-T);
sol = dsolve(eqn,T(0)==80)
sol = 
%Solution for several values of k
for n = 0.1:0.2:1
solk = subs(sol,k=n);
fplot(solk,[0 5]),hold on
end
legend([repmat('k = ',5,1),num2str((0.1:0.1:0.5)')],'Location','best')
  4 comentarios
Davide Masiello
Davide Masiello el 13 de Oct. de 2022
My pleasure. If the answer was helpful, don't forget to Accept it!

Iniciar sesión para comentar.

Más respuestas (1)

Sam Chak
Sam Chak el 13 de Oct. de 2022
The equation derived from Newton's Law of Cooling is given by
The ambient temperature is 70°F. Suppose that the coroner measured the body's temperature when they first arrive at the scene at 8:15 AM. Then, an hour later a second temperature is taken.
If the first temperature is 72.5°F, and the second temperature is 72.0°F, then the coroner can solve for the cooling rate k.
k = - log(2.5/2)
k = -0.2231
Substituting this value back to the equation when the 1st temperature is taken, and solve for
fun = @(t) 70 + 10*exp(-0.2231*t) - 72.5
fun = function_handle with value:
@(t)70+10*exp(-0.2231*t)-72.5
tsol = fsolve(fun, 10)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
tsol = 6.2138
The coroner can postulate that the person died about 6 hours 13 minutes before 8:15 AM, which would be around 2:00 AM.
t = 2:0.01:9;
T = 70 + 10*exp(-0.2231*(t - 2));
plot(t, T), grid on, xlabel('Time (Clock hour)'), ylabel('Body temperature')

Categorías

Más información sobre Programming en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by