%* Euler single-step solution for decay series system of ODEs clear lambda=[1 1 0]; % decay constants, incl. stable daughter c0=[1 0 0]; % initial conditions on c t0=0; % initial time tf=10; % ending time for calculation h=0.05; % step size t=[t0:h:tf]'; % independent variable M=length(lambda); % number of isotopes N=length(t)-1; % number of steps, N+1 = number of nodes C=zeros(N+1, M); % dependent variable C(1,:)=c0; % initial conditions A=zeros(M,M); % coefficients, -ve loss, +ve accumulation A(1,1)=-lambda(1); % primary parent, decay for m=2:M A(m,m-1:m)=lambda(m-1:m); % daughters A(m,m)=-1*A(m,m); % decay end