Pulse Response - First Order Circuits Unit Step functions, Pulse Sources, and SPICE Kevin D. Donohue, University of Kentucky 1 The Unit Step Function The unit step function models the behavior of a switch (i.e. off-on) and can be used to describe more complex circuit sources. 0 for t < 0 u (t ) = 1 for t > 0 ØMultiplying u(t) by a constant changes the value of u(t) for t > 0. ØSubtracting a positive number from the argument of u(t) shifts the step in the positive t direction. ØAdding step functions together results in piece-wise steps with the resultant values equal to the sum of step values in each t interval. Kevin D. Donohue, University of Kentucky 2 Example Determine the unit step response for io(t) the circuit below with input vs(t) = u(t): io(t) 10 Ω 0.1 mF vs(t) 40 Ω Step Response Show: iostep (t ) = 20 18 (0.8 − 0.8 exp(−1250 t ))u (t ) amps 40 16 14 12 10 ma 8 6 4 2 0 0 Kevin D. Donohue, University of Kentucky 1 2 ms 3 4 3 The Unit Pulse Function The unit pulse function is defined as : 1.4 Pulse Function for T = 5 1 0.8 Volts 0 for t < 0 v(t; T ) = 1 for 0 < t < T 0 for t > T 1.2 0.6 0.4 0.2 0 -10 -5 0 5 10 15 Time It can be expressed in terms of a combination of unit step functions: v (t ) == [u (t ) − u (t − T )] Kevin D. Donohue, University of Kentucky 4 Example Determine the pulse response for io(t) the circuit below with input vs(t) = 40v(t) V, where pulse duration T is 2 ms: io(t) 10 Ω vs(t) 0.1 mF 40 Ω Show: i0pulse (t ) = [(0.8 − 0.8 exp( −1250t ))u (t ) − (0.8 − 0.8 exp( −1250( t − 2m )))u (t − 2m )]amps iopulse (t ) = 0.8[u (t ) − u(t − 2m) ]− 0.8 exp( −1250 t )[u (t ) − 12.1825u (t − 2m )]amps Pulse Response 0.8 0.7 0.6 ma 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 ms 5 6 7 8 Kevin D. Donohue, University of Kentucky 5 Plotting Transient Responses Ø Ø Programs written for Matlab can be created either as functions or scripts. For plotting transient responses it is convenient to write a function that acts like the unit step. A function acts like a subroutine in the Matlab workspace. Arguments must be passed to it and it assigns its output to variables in the workspace. Intermediate variable use by the function are cleared. Kevin D. Donohue, University of Kentucky 6 Creating a Function Ø Ø Ø Ø A function is a text file (can use Notepad or Matlab’s editor. If using a word processor, you must store the as a text file.) The first line begins with the word ‘function’ and is followed by the syntax of the function you wish to create. The following lines can be comments, other Matlab functions, and commands to process the input arguments to create the output arguments. The file must be saved with a based name the same as the function and a ‘.m’ extension in the current or working directory. Kevin D. Donohue, University of Kentucky 7 Example Ø Create a function called ‘unit’ such that for an input array it will output a corresponding array of zeros and ones as the unit step function would do. Must save as text file called unit.m function out = unit(t) % This function is the unit step: % % sig = unit(t), where SIG and T are vectors of the same dimension. % % elements of out are either 0 or 1 corresponding to elements of T % being negative or non-negative, respectively. % % written by Kevin D. Donohue 2/93 out = zeros(size(t)); % Initialize output array to zeros ind_of_positive = find(t >= 0); % Find index array of positive values on t-axis out(ind_of_positive) = 1; % Assign points corresponding to postive values to 1 Kevin D. Donohue, University of Kentucky 8 Create Plot in Matlab i0pulse (t ) = [(0.8 − 0.8 exp(−1250t ) )u (t ) − (0.8 − 0.8 exp(−1250(t − 2m)))u (t − 2 m)]amps >> tau = 1/1250; % Define time constant >> t = [-0.1:(tau/50):(10*tau+2e-3)]; % Create time axis >> i0 = (.8-.8*exp(-t/tau)).*unit(t)-(.8-.8*exp(-(t-2e-3)/tau)).*unit(t-2e-3); >> plot(t,i0) >> xlabel(‘Seconds’) >> ylabel(‘Amps’) >> title(‘Transient Response’) Kevin D. Donohue, University of Kentucky 9 SPICE Simulation with Step Source Do a SPICE Simulation to determine the pulse response for io(t) the Previous circuit with input vs(t) = 40v(t) V, where pulse duration T is 2 ms: Ø To solve you must do a transient analysis, define the voltage source as piece-wise linear, and describe its transient properties. R 10 (Amp) +0.000e+000 +2.000m +4.000m Time +6.000m R0 40 tranex -Transient -14 C 0.0001 +8.000m V 0 tranex-Transient-14-Table TIME I(VAM) (s) (Amp) +0.000e+000 +0.000e+000 +10.000n +99.999n +10.840n +109.104n : : : : : : +7.285m +972.534u +7.445m +795.710u +7.605m +651.035u +7.765m +532.665u +7.925m +435.817u VAm (s) +8.000m +500.000m +396.630u +0.000e+000 I(VAM) Kevin D. Donohue, University of Kentucky 10 SPICE Simulation with Switch Do a SPICE Simulation to determine the pulse response for io(t) the circuit below with input vs(t) = 40 V, where pulse duration T is 2 ms: Ø To solve you must do a transient analysis, define auxiliary circ uits for voltage sources and meters that control the opening and closing of the switches. R 10 SwitchV0 VAm R0 40 C 0.0001 SwitchV1 V 40 tranexsw-Transient-0 (Amp)+0.000e+000 +2.000m +4.000m Time (s) +6.000m +8.000m +600.000m (Amp) +400.000m V1 0 V0 0 IVm IVm0 +200.000m +0.000e+000 I(VAM) Kevin D. Donohue, University of Kentucky 11