You are on page 1of 7

Lab-9

Radioactive decay model and Trajectory motion


9.1 Objective

 Understanding of Radioactive decay model and Half life


 Matlab script to study the effect of different parameters on decay model
 Understanding Trajectory motion and examples of projectile motions
 Matlab script to realize the effect of projectile motion with aerodynamics

9.2 Theoretical Overview


9.3 Matlab Lab code for Radioactive Decay

%Ploting Decay function for various constant fplot('[exp(-2*x),exp(-x),exp(-0.5*x)]', [0,5]);

%Putting x-Label xlabel('x'); %Putting y-label ylabel('y');

%Providing legend to the graph legend('y = exp(-2x)','y = exp(-x)','y = exp(-0.5x)',0);

9.4 Trajectory Motion

Projectile motion is the motion of an object thrown or projected into the air, subject to only the
acceleration of gravity. The object is called a projectile, and its path is called its trajectory. The
motion of falling objects, as covered in Problem-Solving Basics for One-Dimensional Kinematics, is a
simple one-dimensional type of projectile motion in which there is no horizontal movement. Two-
dimensional projectile motion, such as that of a football or other object for which air resistance is
negligible. The most important fact to remember here is that motions along perpendicular axes are
independent and thus can be analyzed separately and called Kinematics in Two Dimensions. where
vertical and horizontal motions were seen to be independent. The key to analyzing two-dimensional
projectile motion is to break it into two motions, one along the horizontal axis and the other along
the vertical.

9.5 Aerodynamic Drag

Aerodynamic drag is the force needed to overcome these miniature forces when an object moves
through air at a certain velocity. You can feel this force when you ride a bike. The faster you travel,
the more air you must push through and the higher your induced drag. Air molecules are extremely
small. On average there are around 26 quintillion (10^18) air molecules within a 1cm cube of air.
When a solid object moves through air, it interacts with all these molecules generating millions of
miniature forces

9.6 Example

Solve the following differential equations for 𝑐𝑑 ={0.1, 0.3,0.5} N/m.

9.6.1 Solution:

As explained earlier, to solve the above two differential equations, we must reduce each of them
into two first order differential equations.
9.7 MATLAB Code

Type the following code in a separate m-file. As mentioned earlier, the system derivatives must be
written in a separate m-file. Since the name of the function is ‘airdrag’, save the m-file as ‘airdrag.m’
in the current directory.

function yp = airdrag(t,y)

m = 10; cd = 0.2; g = 9.81; w = m*g; yp = zeros(4,1); yp(1) = y(2);

yp(2) = ((-cd/m)*y(2)*(y(2)^2+y(4)^2)^(0.5)); yp(3) = y(4);

yp(4) = ((-w/m)-(cd/m)*y(4)*(y(2)^2+y(4)^2)^(0.5));

Open a new m-file and type the following code for the main program. This program calls the function
‘airdrag.m’ to solve the differential equations. Again ‘tspan represents the time interval and ‘y0’
represents the initial condition vector. The plots hav to be drawn between the displacement in the x
direction and the displacement in the direction. Refer to the handout ‘Introduction to MATLAB’ for
the explanation about using the ‘hold’ command with the help of a ‘counter’ variable.

tspan=[0 5]; y0=[0;100;0;10]

[t,y]=ode45('airdrag',tspan,y0);

plot(y(:,1),y(:,3)) grid xlabel(‘X-Displacement’) ylabel(‘Y-Displacement’) title(‘X vs Y Displacement’)

hold on;

It can be seen from the plots that as the coefficient of the aerodynamic drag is increased the
maximum value of the displacement in the y direction decreases. The value of the displacement in
the x direction, for which the displacement in the y direction is maximum, also decreases. Here the
plots have been zoomed to the current version so that the difference in the curves could be seen
clearly.

9.8 Tasks

9.8.1 Pick any disease transmission model of your choice. Explain its working in your own
words. Provide Its mathematical equation, Matlab code with effects of parameters variations.
Paste code and output in the end.

Mathematical equation

The SIR Model has been developed to simulate an epidemic over time. The model consists of a
system of 3 differential equations that express the rates of change of 3 variables over time. The 3
variables are:

1. S - the susceptibles of getting the infection.

2. I - the infected.

3. R - the recovered from the infection.

ds
=−B . S . I +δ . R
dt
dI
=B . S . I −ɣ . I
dt
dR
=ɣ . I −δ . R
dt
Code

% Model parameters

beta = 5*10^-9; % rate of infection

gamma = 0.12; % rate of recovery (try also 0.07)

delta = 0.0; % rate of immunity loss

N = 6*10^7; % Total population N = S + I + R

I0 = 10; % initial number of infected

T = 300; % period of 300 days

dt = 1/4; % time interval of 6 hours (1/4 of a day)

fprintf('Value of parameter R0 is %.2f',N*beta/gamma)

% Calculate the model

[S,I,R] = sir_model(beta,gamma,delta,N,I0,T,dt);

% Plots that display the epidemic outbreak

tt = 0:dt:T-dt;

% Curve

plot(tt,S,'b',tt,I,'r',tt,R,'g','LineWidth',2); grid on;

xlabel('Days'); ylabel('Number of individuals');

legend('Susci','I','R');

%Code for function sir_model

function [S,I,R] = sir_model(beta,gamma,delta,N,I0,T,dt)

% if delta = 0 we assume a model without immunity loss

S = zeros(1,T/dt);

S(1) = N;

I = zeros(1,T/dt);

I(1) = I0;

R = zeros(1,T/dt);

for tt = 1:(T/dt)-1

% Equations of the model


dS = (-beta*I(tt)*S(tt) + delta*R(tt)) * dt;

dI = (beta*I(tt)*S(tt) - gamma*I(tt)) * dt;

dR = (gamma*I(tt) - delta*R(tt)) * dt;

S(tt+1) = S(tt) + dS;

I(tt+1) = I(tt) + dI;

R(tt+1) = R(tt) + dR;

end

end

Output

Figure 9.1

Working

We are implementing SIR model of disease transmission here which stands for Susceptibles, Infected
and Recovered model. In this model we will first specify beta which is rate of infection and then
gamma which is rate of recovery. Then we will specify total number of population, number of
infected persons and total time period over which we want to observe the disease transmission
model. Then we plot days against number of individuals. But, before going to the explanation of plot,
I will explain the function sir_model created in code. That model is created to implement the
Mathematical equation of SIR model which is already explained. Now coming on to the plots, The
blue line shows the number of susceptibles, red for infected and green for recovered. So what
actually happening here is that first susceptibles are high and infected and recovered are
understandably zero. But as soon as the susceptibles become infected the graph of susceptibles
diminishes. Also we see after a spike of infected, it goes down to a constant line that is because
those infected gets recovered in the mean time. Also, that’s the main reason of the high recovered
graph. It keeps on increasing because some susceptibles are also becoming recovered with infected
too.

You might also like