Half life question in matlab

조회 수: 6 (최근 30일)
Bob
Bob 2015년 1월 29일
댓글: noor iraq 2020년 5월 10일
Metronidazole (used to treat infections) has a half life of H = 7.9 hours. Use solve to calculate [5 pt] the amount of time it takes for 50mg to decay to 20mg. Note that the decay constant is −ln(2)/H.
Can someone help me with the code that would be used to solve this type of problem?

답변 (2개)

Star Strider
Star Strider 2015년 1월 29일
See the documentation for the solve function. The question itself has all the information you need otherwise. Particularly note ‘−ln(2)/H’.
The question assumes single-compartment kinetics for metronidazole, an anti-protozoal agent that is also active against C. dificile and some others.
  댓글 수: 6
Star Strider
Star Strider 2015년 1월 30일
For the record, the solution to this problem is quite simply:
syms C(t)
H = 7.9;
K = -log(2)/H;
C(t) = exp(K*t);
t20s = solve(C == 20/50, t);
t20d = vpa(t20s, 3)
giving:
t20d =
10.4
So the concentration has reached the 20mg level at 10.4 hours.
noor iraq
noor iraq 2020년 5월 10일
And if it with its Graph ?

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


Roger Stafford
Roger Stafford 2015년 1월 29일
Bradley, just ask yourself, "what power of 2 do I have to divide 50 by to get 20?". Then that power should be the ratio of the necessary decay time to 7.9 hours. It would be a very simple one-line matlab computation.
  댓글 수: 2
Bob
Bob 2015년 1월 29일
편집: Bob 2015년 1월 29일
so that would be 20 because 20^2 then divide that by 20 which gives you 20. So I have this: solve(7.9*(-log(2)/(log(50/20)))). But I am getting an error because I don't have a variable. Would I replace 7.9 with x?
Roger Stafford
Roger Stafford 2015년 1월 30일
If you discard that incorrect minus sign, you've already solved your problem without using 'solve'. They ought to give you extra credit for that.
If you are determined to use 'solve', then go back a step and write the equation you were trying to solve before you took the logarithm.

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

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by