Halflife Plotting program

The following program was written to plot the decay curves for three isotopes. The program prompts the user for the half-lives of three isotopes and then plots the curve and the semilog graph.

% Half-life program
%  This program allows the user to enter the half-lives
% of three isotopes and plot the decay functions

% User inputs Half-lives of 3 isotopes
% All three should be in same units

a = input ('Enter Half-life of Isotope 1? ');
b = input ('Enter Half-life of Isotope 2? ');
c = input ('Enter Half-life of Isotope 3? ');

% Calculate amount remaining at time t
N = 1000;
t = 0:1:100;
y1 = N * exp(-.693*t/a);
y2 = N * exp(-.693*t/b);
y3 = N * exp(-.693*t/c);

% Plot graph
title ('Nuclear Decay of three Isotopes-SemiLog');
xlabel ('Time');
ylabel ('Log Amount Remaining');
text(10,8,'Isotope 1 in yellow');
text(10,4,'Isotope 2 in magenta');
text(10,2,'Isotope 3 in cyan');


plot (t,y1,t,y2,t,y3)
title ('Comparing Nuclear Decay of three Isotopes');
xlabel ('Time');
ylabel ('Amount Remaining');
text(45,950,'Isotope 1 in yellow');
text(45,850,'Isotope 2 in magenta');
text(45,750,'Isotope 3 in cyan');