The figure below shows a series second-order RLC circuit. The system input is a step voltage source vin(t) = u(t) and the output is the voltage across resistor R.
As shown in the section regarding second-order LCCDEs impulse response, the Kirchhoff's voltage law equation can be written as (1)/(C)∫i(t)dt + L(di)/(dt) + Ri = vin(t) = u(t).
Differentiating results: (d^(2)i)/(dt^(2)) + (R)/(L)(di)/(dt) + (1)/(LC)i = (1)/(L)δ(t). The circuit's characteristic equation can be written as: s^(2) + a1s + a_(0)^(2) = s^(2) + (R)/(L)s + (1)/(LC) = 0.
A system's impulse response can be found using the residue function.
Ex: for the LCCDE b_(2)(d^(2)y)/(dt^(2)) + b_(1)(dy)/(dt) + b0 = a1(dx)/(dt) + a0.
[[R, P]] = residue([[a, a0]], [b2, b1, b0])
Vectors a1a0 and b2b1b0 are the input (right-hand side) and output (left-hand side) coefficients, respectively. Vector R contains the residues and vector P contains the roots (poles) of the characteristic equation. If the impulse response has the form h(t) = Ae^(Bt) + Ce^(Dt), then A = R(1), B = P(1), C = R(2), and D = P(2).
Convolution of the impulse response with any given input including the step function can provide the system's output. y(t) = x(t)**h(t). The unit step function in MATLAB can be defined as heaviside(1:length).
Part 1: Circuit's damping coefficient and damping type
1a) For R = 1Ω, L = 1H, C = 10F, find the circuit's damping coefficient from the characteristic equation and assign to variable Zel.
1b) What is the damping type? Define variable Damping1 and store the string "over", "under", or "critical" based on an if... elseif statement for the response type. All the response string characters should be lowercase. Ex:
if Ze1 < 1
Damping1 = "under"
% Use elseif for the second condition and else for the last condition for the other end
Part 2: Circuit's impulse response
2a) Use the residue function to find the impulse response coefficients. Store the result elements in variables A, B, C, and D as defined above. A and C are the coefficients of the first and second exponentials, respectively. B and D are the coefficients of the first and second exponentials multiplying by t, respectively.
2b) Define a time interval starting at t0 = 0 to tend = 60 seconds with a time step of ts = 1s. Find the impulse response for this time interval and store the result in variable h1.
2c) Plot the impulse response for the given time interval.
2d) Find the impulse response for t = 10s and t = 30s and assign to variables h1_(10)sec and h1_30sec, respectively. Find the values either from the plot or the h1 array.
Part 3: Circuit's step response
3a) Determine the circuit's step response using the conv function and the circuit's impulse response h1. Find the step response for the above time interval and store the result in variable ystep1.
3b) Plot the step response for the given time interval.
3c) Find the step response for t = 10s and t = 30s and assign to variables ystep1_10sec and ystep1_30sec, respectively. Find the values either from the plot or the ystep1 array.