Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Anonymous function (function_handle class) and Script problem Write a MATLAB scr

ID: 1998426 • Letter: A

Question

Anonymous function (function_handle class) and Script problem Write a MATLAB script called ExpDec. Name that plots the mass (in grams) of a substance left after radioactive decay versus time (in years). The expected result is shown below. Compute the remaining mass using the equation: m = m_0e^-lambda where, m = remaining mass, m_o = initial mass, lambda = decay rate (in year^-1. and t = time (in year). Use the following given values: m_o = 50 g, lambda = 0.0495 year^-1, and t = 100 years. Generate a time vector from 0 to t years with N = 1000 data points. Create an anonymous function (function_handle variable class) then solve the remaining mass vector. After computations and plotting, use the disp function to display the mass left to the substance after 100 years. Approximate the half-life of the substance. Half-life is the time required to reduce the original mass by 50%.

Explanation / Answer

The MATLAB code is as follows:

close all;
clear all;
m0=50;
lambda=0.0495;
t=linspace(0,100,1000);
for i=1:1:length(t)
m(i)=m0*exp(-lambda*t(i));
end
plot(t,m)

The mass left after 100 years=0.3542 gm

The half life is approximately=14 years

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote