Find the Impulse Response of a Circuit
Find the impulse response for a circuit that is composed of a resistor and an inductor
, and is driven by a time-dependent voltage
.
The current can be computed by solving a linear first-order differential equation
.
Set up the differential operator corresponding to the left-hand side of the ODE.
In[1]:=
![Click for copyable input](assets.en/find-the-impulse-response-of-a-circuit/In_135.png)
voltage = L i'[t] + R i[t];
Assume that the switch is initially open.
In[2]:=
![Click for copyable input](assets.en/find-the-impulse-response-of-a-circuit/In_136.png)
init = i[0] == 0;
Compute the impulse response for the circuit using GreenFunction.
In[3]:=
![Click for copyable input](assets.en/find-the-impulse-response-of-a-circuit/In_137.png)
gf[s_, t_] =
GreenFunction[{voltage, init}, i[t], {t, 0, \[Infinity]}, s]
Out[3]=
![](assets.en/find-the-impulse-response-of-a-circuit/O_74.png)
Plot the impulse response at .
In[4]:=
![Click for copyable input](assets.en/find-the-impulse-response-of-a-circuit/In_138.png)
Plot[gf[s, t] /. {s -> 1, R -> 2, L -> 4}, {t, 0, 7},
PlotTheme -> "Scientific", AxesLabel -> {"t", "i[t]"}]
Out[4]=
![](assets.en/find-the-impulse-response-of-a-circuit/O_75.png)
Compute the response of the circuit to a step voltage.
In[5]:=
![Click for copyable input](assets.en/find-the-impulse-response-of-a-circuit/In_139.png)
v[t_] := HeavisideTheta[t];
In[6]:=
![Click for copyable input](assets.en/find-the-impulse-response-of-a-circuit/In_140.png)
current = Integrate[gf[s, t] v[s], {s, 0, t}, Assumptions -> t > 0]
Out[6]=
![](assets.en/find-the-impulse-response-of-a-circuit/O_76.png)
Visualize the step response.
In[7]:=
![Click for copyable input](assets.en/find-the-impulse-response-of-a-circuit/In_141.png)
Plot[{current /. {R -> 2, L -> 4}, 0.5} // Evaluate, {t, 0, 6},
PlotTheme -> "Scientific"]
Out[7]=
![](assets.en/find-the-impulse-response-of-a-circuit/O_77.png)