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

조회 수: 4 (최근 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
Davide Masiello
Davide Masiello 2022년 10월 13일
My pleasure. If the answer was helpful, don't forget to Accept it!

댓글을 달려면 로그인하십시오.

추가 답변 (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