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

9 次查看(过去 30 天)
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.

采纳的回答

Davide Masiello
Davide Masiello 2022-10-11
编辑:Davide Masiello 2022-10-13
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 个评论

请先登录,再进行评论。

更多回答(1 个)

Sam Chak
Sam Chak 2022-10-13
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')

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by