% RLC2 MATLAB script file which generates the advanced solution to % Lesson 5 of the 6.003 MATLAB "Pico"-Course. This script calls % on functions residue.m and step.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 ']; t = linspace(0,T,201); % Cycle through the cases, generating all three plots on the same figure for case = 1:3 Hnum = [1/C 0]; %Define system function Hden = [1 1/(R*C) 1/(L(case,1)*C)]; %To continue lesson, type: return keyboard %Use printsys to verify system function [K,P] = residue(Hnum,Hden) %Determine Partial Fraction Expansion v(case,:) = step(Hnum,Hden,t)'; %function call subplot(3,1,case), hold on plot( t, v(case,:), 'rx'); 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');