The equation to calculate the amount of a radioactive substance remaining after
ID: 3567127 • Letter: T
Question
The equation to calculate the amount of a radioactive substance remaining after a period of time is:
where A is the amount remainins, A_0 is the beginning amount, t is the time period and h is the half-life in the same units as the time period. For example, if 15 grams of a radioactive substance with a half-life of 1.68 years was left for 2.54 years, approximately 5.26 grams would remain. For this problem assume that the amount is in grams and the time is in years.
(A) Write a function to calculate the half-life of a radioactive substance given (passed to the function) the original amount, the time period and the half-life. The funtion will return the amount remaining.
(B) Write a script that will ask for the original amount, the time period and the half-life and then pass those three arguments to the function written in part (A). The function should return the remaining amount. Display the result with the line:
The amount remaining of aaa grams after bbb years is ccc grams.
where aaa is the original amount, bbb is the time period and ccc is the remaining amount. Round the numbers to 2 decimal places.
The equation to calculate the amount of a radioactive substance remaining after a period of time is: A = A0 * 2^-t*/h where A is the amount remainins, A_0 is the beginning amount, t is the time period and h is the half-life in the same units as the time period. For example, if 15 grams of a radioactive substance with a half-life of 1.68 years was left for 2.54 years, approximately 5.26 grams would remain. For this problem assume that the amount is in grams and the time is in years. (A) Write a function to calculate the half-life of a radioactive substance given (passed to the function) the original amount, the time period and the half-life. The funtion will return the amount remaining. (B) Write a script that will ask for the original amount, the time period and the half-life and then pass those three arguments to the function written in part (A). The function should return the remaining amount. Display the result with the line: The amount remaining of aaa grams after bbb years is ccc grams. where aaa is the original amount, bbb is the time period and ccc is the remaining amount. Round the numbers to 2 decimal places.Explanation / Answer
Here you go :)
%halfLifeFunction (to be saved as halfLifefunc.m)
function ret =halfLifefunc( A,B,C )
ret=A*power(2,-(B/C));
end
%script to call the above function
%a is the initial amount
%t is the time period
%h is the halflife period
a=input('Enter the Time Period: ');
t=input('Enter the Time Period: ');
h=input('Enter the Half life: ');
z=sprintf('%.2f',halfLifefunc(a,t,h));
x=['The amount remaining of ',num2str(a(1)),' grams after ',num2str(t(1)),' years is ',z,' grams'];
disp(x);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.