% RLC1		MATLAB script file which generates the basic solution to 
%		Lesson 5 of the 6.003 MATLAB "Pico"-Course.  This script calls
%		on function   rlcstep.m     for each of the three cases, and 
%		includes the necessary plot commands.

% Case (i)  : R = 1 Ohm, C = 1 Farad, L = 6 Henrys, T = 20 sec
% Case (ii) : R = 1 Ohm, C = 1 Farad, L = 1 Henry , T = 20 sec
% Case (iii): R = 1 Ohm, C = 1 Farad, L = 4 Henrys, T = 20 sec

% Define component values
T = 20;
R = 1;
C = 1;
L = [6; 1; 4];
words = ['poles real,distinct'; ...
         'poles complex conj.'; ...
         'poles real,equal   '];

% Cycle through the cases, generating all three plots on the same figure
for case = 1:3
  v(case,:) = rlcstep(R,L(case,1),C,T);		%function call
  subplot(3,1,case),plot( linspace(0,T,size(v,2)), v(case,:) );
  xlabel('t    (sec)');
  ylabel('v(t)');
  text(10,0.4,words(case,:));
end

subplot(3,1,1)
title('Parallel RLC Circuit: Step Response for Three Cases');
