Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* convenient shortcuts *)
- (* circuit impedances in the s-domain *)
- xl[l_] := s l; xc[c_] := 1/(s c); par[z1_, z2_] := (z1 z2)/(z1 + z2);
- (* prefixes *)
- k = 1000.; M = 1.*^6; u = 1.*^-6; p = 1.*^-12;
- (* nominal values *)
- nominals = {cp -> 10 p, ri -> 100 k, cf -> 0 p, rf -> 200 k,
- av -> -4500., pole -> 2 Pi 30000.};
- (* the op amp has a one-pole roll off at 30kHz *)
- lt1365 = av pole/(s + pole);
- (* derive a closed-loop transfer function *)
- (* node currents sum to zero into the inverting input node with
- voltage v *)
- eq1 = (vin - v)/ri + (0 - v)/xc[cp] + (vout - v)/par[rf, xc[cf]] == 0;
- (* equation for op amp gain *)
- eq2 = vout == lt1365 v;
- (* determine transfer function as vout/vin *)
- temp = Eliminate[{eq1, eq2}, v];
- tf = (vout /. Solve[temp, vout][[1]])/vin // Simplify;
- tfm = TransferFunctionModel[tf, s];
- (* nominal response of transfer function *)
- nominalTFM = tfm /. nominals // Simplify;
- SetOptions[BodePlot, FeedbackType -> None,
- ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}},
- GridLines -> Automatic, ImageSize -> 300,
- FrameLabel -> {{"Frequency", "dB"}, {"Frequency", "Degrees"}},
- PhaseRange -> {-[Pi], [Pi]}, PlotRange -> Automatic];
- plot[1] =
- BodePlot[nominalTFM, {2 Pi 10^4, 2 Pi 1*^8},
- PlotLabel -> "Nominal Response"]
- (* the response to a negative pulse shows severe ringing *)
- (* brought about by the parasitic capacitance *)
- out = OutputResponse[
- nominalTFM, -UnitStep[t - 5 u] + UnitStep[t - 10 u], {t, 0, 15 u}];
- plot[2] =
- Plot[out /. t -> tt u, {tt, 0, 15}, PlotRange -> Automatic,
- Frame -> True, FrameLabel -> {"[Mu]s", None},
- PlotLabel -> "Pulse Response", PlotLegends -> {"Nominal"}]
- (* The ringing can be reduced by placing a zero in the feedback using
- cf *)
- (* check the root locus plot *)
- (* without compensation the systen is almost oscillating *)
- (* a value of cf = 0.478p brings the poles to the real axis *)
- plot[3] = RootLocusPlot[tf /. cf -> cf1 /. nominals, {cf1, 0, 1 p},
- FeedbackType -> None,
- PlotRange -> {{-.3*^8, .1*^8}, All},
- AspectRatio -> .7, PlotLabel -> "Closed-Loop Poles",
- PoleZeroMarkers -> {"", Automatic, "",
- "ParameterValues" -> {0, .25 p, .45 p, .478 p, .5 p, .8 p}}]
- improvedTFM = tfm /. cf -> .478 p /. nominals;
- plot[4] =
- BodePlot[improvedTFM, {2 Pi 10^4, 2 Pi 1*^8},
- PlotLabel -> "Improved Response"]
- out2 = OutputResponse[
- improvedTFM,
- -UnitStep[t - 5 u] + UnitStep[t - 10 u],
- {t, 0, 15 u}];
- plot[5] =
- Plot[out2 /. t -> tt u, {tt, 0, 15}, PlotRange -> Automatic,
- Frame -> True, FrameLabel -> {"[Mu]s", None}, PlotStyle -> {Red},
- PlotLabel -> "Pulse Response", PlotLegends -> {"Improved"}];
- plot[6] = Show[plot[2], plot[5], PlotLabel -> "Pulse Response"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement