# RLC Circuit Driven by a Periodic Signal and White Noise

#### Consider an electrical circuit consisting of a resistor, inductor, and capacitor connected in series. The circuit is under external voltage, which is a superposition of a periodic signal and white noise.

 In:= XCapacitorChargeModel = ItoProcess[{ \[DifferentialD]\[ScriptCapitalQ][t] == \[ScriptCapitalI][ t] \[DifferentialD]t, \[ScriptCapitalL] \[DifferentialD]\[ScriptCapitalI][ t] + \[ScriptCapitalR] \[ScriptCapitalI][ t] \[DifferentialD]t + 1/\[ScriptCapitalC] \[ScriptCapitalQ][t] \[DifferentialD]t == Sin[\[Omega] t] \[DifferentialD]t + \[Sigma] \[DifferentialD]w[ t]}, \[ScriptCapitalQ][ t], {{\[ScriptCapitalI], \[ScriptCapitalQ]}, {0, 0}}, t, w \[Distributed] WienerProcess[]]
 Out= #### Define the parameters of the model.

 In:= Xparams = {\[ScriptCapitalL] -> 2, \[ScriptCapitalC] -> 2, \[ScriptCapitalR] -> 1/2, \[Omega] -> 3/2, \[Sigma] -> 1/4};

#### Compute the mean function, i.e. the mean value of the charge of the capacitor as a function of time.

 In:= Xmqf = Simplify[Mean[CapacitorChargeModel[t] /. params]]
 Out= #### Solve the deterministic problem in the absence of noise and compare it with the mean function.

 In:= Xdetq = (Q[t] /. First[DSolve[\[ScriptCapitalL] Q''[t] + \[ScriptCapitalR] Q'[t] + Q[t]/\[ScriptCapitalC] == Sin[\[Omega] t] \[And] Q == 0 && Q' == 0 /. params, Q[t], t]]);
 In:= XSimplify[detq == mqf]
 Out= #### Compute the variance function.

 In:= Xvf = Simplify[Variance[CapacitorChargeModel[t] /. params]]
 Out= #### Simulate the model using the strong Kloeden-Platen-Schurz scheme of order .

 In:= Xpath = RandomFunction[ CapacitorChargeModel /. params, {0., 22., 0.002}, 12, Method -> "KloedenPlatenSchurz"]
 Out= #### Visualize the simulated paths.

 In:= Xpls = ListLinePlot[path, PlotRange -> All, ImageSize -> 400]
 Out= #### Visualize a 95% confidence band about the mean function.

 In:= Xepl = With[{q = Quantile[NormalDistribution[], (1 + .95)/2]}, Plot[{mqf - q Sqrt[vf], mqf, mqf + q Sqrt[vf]} /. params // Evaluate, {t, 0, 22}, PlotRange -> All, PlotStyle -> Directive[Thick, Black], FillingStyle -> Directive[Lighter[Blue, .5], Opacity[.15]], Filling -> {1 -> {3}}, ImageSize -> 400]]
 Out= #### Combine the plots together.

 In:= XShow[{epl, pls}, PlotRange -> All]
 Out= 