%example6p14.m
%displays current as function of roots in characteristic equation
% il(t)=(60/(s2-s1))*(exp(-s1*t)-exp(s2*t));
% with restriction s1+s2=20, s1~=s2.
t=linspace(0,5,500)'; %set display interval as a column vector
ils=[]; %reserve space to store curves
for s1=1:19
   s2=20-s1;
   if s1~=s2
      il=(60/(s2-s1))*(exp(-s1*t)-exp(-s2*t));
      ils=[ils il]; %save new trace as a column in matrix
   end
end
%now with one command we plot all the columns as functions of time
plot(t,ils), grid, xlabel('Time(s)'),ylabel('i(A)')
title('CURRENT AS FUNCTION OF MODES')
Estimate charge by estimating area under the curve
For this curve the area is approx. 12 squares