Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. (* convenient shortcuts *)
  2.  
  3. (* circuit impedances in the s-domain *)
  4. xl[l_] := s l; xc[c_] := 1/(s c); par[z1_, z2_] := (z1 z2)/(z1 + z2);
  5.  
  6. (* prefixes *)
  7. k = 1000.; M = 1.*^6; u = 1.*^-6; p = 1.*^-12;
  8.  
  9. (* nominal values *)
  10. nominals = {cp -> 10 p, ri -> 100 k, cf -> 0 p, rf -> 200 k,
  11. av -> -4500., pole -> 2 Pi 30000.};
  12.  
  13. (* the op amp has a one-pole roll off at 30kHz *)
  14. lt1365 = av pole/(s + pole);
  15.  
  16. (* derive a closed-loop transfer function *)
  17.  
  18. (* node currents sum to zero into the inverting input node with
  19. voltage v *)
  20. eq1 = (vin - v)/ri + (0 - v)/xc[cp] + (vout - v)/par[rf, xc[cf]] == 0;
  21.  
  22. (* equation for op amp gain *)
  23. eq2 = vout == lt1365 v;
  24.  
  25. (* determine transfer function as vout/vin *)
  26.  
  27. temp = Eliminate[{eq1, eq2}, v];
  28.  
  29. tf = (vout /. Solve[temp, vout][[1]])/vin // Simplify;
  30.  
  31. tfm = TransferFunctionModel[tf, s];
  32.  
  33. (* nominal response of transfer function *)
  34.  
  35. nominalTFM = tfm /. nominals // Simplify;
  36.  
  37. SetOptions[BodePlot, FeedbackType -> None,
  38. ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}},
  39. GridLines -> Automatic, ImageSize -> 300,
  40. FrameLabel -> {{"Frequency", "dB"}, {"Frequency", "Degrees"}},
  41. PhaseRange -> {-[Pi], [Pi]}, PlotRange -> Automatic];
  42.  
  43. plot[1] =
  44. BodePlot[nominalTFM, {2 Pi 10^4, 2 Pi 1*^8},
  45. PlotLabel -> "Nominal Response"]
  46.  
  47. (* the response to a negative pulse shows severe ringing *)
  48. (* brought about by the parasitic capacitance *)
  49.  
  50. out = OutputResponse[
  51. nominalTFM, -UnitStep[t - 5 u] + UnitStep[t - 10 u], {t, 0, 15 u}];
  52.  
  53. plot[2] =
  54. Plot[out /. t -> tt u, {tt, 0, 15}, PlotRange -> Automatic,
  55. Frame -> True, FrameLabel -> {"[Mu]s", None},
  56. PlotLabel -> "Pulse Response", PlotLegends -> {"Nominal"}]
  57.  
  58. (* The ringing can be reduced by placing a zero in the feedback using
  59. cf *)
  60. (* check the root locus plot *)
  61. (* without compensation the systen is almost oscillating *)
  62. (* a value of cf = 0.478p brings the poles to the real axis *)
  63. plot[3] = RootLocusPlot[tf /. cf -> cf1 /. nominals, {cf1, 0, 1 p},
  64. FeedbackType -> None,
  65. PlotRange -> {{-.3*^8, .1*^8}, All},
  66. AspectRatio -> .7, PlotLabel -> "Closed-Loop Poles",
  67. PoleZeroMarkers -> {"", Automatic, "",
  68. "ParameterValues" -> {0, .25 p, .45 p, .478 p, .5 p, .8 p}}]
  69.  
  70. improvedTFM = tfm /. cf -> .478 p /. nominals;
  71.  
  72. plot[4] =
  73. BodePlot[improvedTFM, {2 Pi 10^4, 2 Pi 1*^8},
  74. PlotLabel -> "Improved Response"]
  75.  
  76. out2 = OutputResponse[
  77. improvedTFM,
  78. -UnitStep[t - 5 u] + UnitStep[t - 10 u],
  79. {t, 0, 15 u}];
  80.  
  81. plot[5] =
  82. Plot[out2 /. t -> tt u, {tt, 0, 15}, PlotRange -> Automatic,
  83. Frame -> True, FrameLabel -> {"[Mu]s", None}, PlotStyle -> {Red},
  84. PlotLabel -> "Pulse Response", PlotLegends -> {"Improved"}];
  85.  
  86. plot[6] = Show[plot[2], plot[5], PlotLabel -> "Pulse Response"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement