* Z:\home\khalils\Downloads\files\data\raw_asc\LoopGain2.asc
* Generated by LTspice 26.0.1 for Windows.
* Here the open loop gain is determined from the closed loop system[1].\nThe open loop gain can be plotted by plotting the quantity:\n \n-1/(1-1/(2*(I(Vi)@1*V(x)@2-V(x)@1*I(Vi)@2)+V(x)@1+I(Vi)@2))\n \nAlternatively, you add the following line to your plot.defs file:\n.func T.et.al() -1/(1-1/(2*(I(Vi)@1*V(x)@2-V(x)@1*I(Vi)@2)+V(x)@1+I(Vi)@2))\nAnd then plot simply T.et.al()\n \nThis is an improvement over the technique shown in LoopGain.asc \nbecause it (i) accounts for reverse feedback(it doesn't even\nmatter if you reverse the direction of the probe -- you still compute\nthe same open loop response) and (ii) the inserted probe elements\nresult in a smaller, sparser circuit matrix.
* This example schematic is supplied for informational/educational purposes only.
* [1] Michael Tian, V. Visvanathan, Jeffrey Hantgan, and Kenneth Kundert,\n "Striving for Small-Signal Stability", IEEE Circuits and Devices Magazine,\n vol. 17, no. 1, pp. 31-41, January 2001.
* Probe elements added to inject\nsignals to measure the open loop\nresponse from the closed loop system
* This example is based on posts contributed by Frank Wiedmann to the independent users' group at http://groups.yahoo.com/group/LTspice
* Library below included based on ModelFile attribute of instance XU1 (C:\users\khalils\AppData\Local\LTspice\lib\sym\OpAmps\LT1001.asy)
Vi x N002 AC {u(-prb)}
V5 -V 0 -15
XU1 0 N001 +V -V N002 LT1001 ;pnba In+)In-)V+)V-)OUT
R2 N001 0 1K
R3 x N001 1K
Ii 0 x AC {u(prb)}
V1 +V 0 15
R1 x 0 100
C1 x N001 3p
.ac dec 30 .1 100Meg
.step param prb list -1 1 ; set prb=0 to turn off probe
.lib LTC.lib
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 2168 1300
WIRE 144 144 144 128
WIRE -32 160 -80 160
WIRE 112 160 -32 160
WIRE -32 176 -32 160
WIRE 384 176 176 176
WIRE 672 176 464 176
WIRE 944 176 672 176
WIRE 112 192 80 192
WIRE 672 192 672 176
WIRE 144 224 144 208
WIRE 944 224 944 176
WIRE 1008 224 944 224
WIRE 1008 240 1008 224
WIRE -32 272 -32 256
WIRE 192 272 96 272
WIRE 288 272 256 272
WIRE 672 288 672 272
WIRE 1008 336 1008 320
WIRE -80 352 -80 160
WIRE 96 352 96 272
WIRE 96 352 -80 352
WIRE 128 352 96 352
WIRE 288 352 288 272
WIRE 288 352 208 352
WIRE 944 352 944 224
WIRE 944 352 288 352
WIRE -224 416 -224 400
WIRE -112 416 -112 400
WIRE -224 512 -224 496
WIRE -112 512 -112 496
RECTANGLE Normal 912 320 336 48
SYMBOL voltage -224 400 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V5
SYMATTR Value -15
SYMBOL cap 256 256 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C1
SYMATTR Value 3p
SYMBOL res -48 160 R0
SYMATTR InstName R2
SYMATTR Value 1K
SYMBOL res 992 224 R0
SYMATTR InstName R1
SYMATTR Value 100
SYMBOL Opamps\\LT1001 144 112 R0
WINDOW 0 27 42 Left 2
WINDOW 3 25 87 Left 2
SYMATTR InstName U1
SYMBOL res 224 336 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R3
SYMATTR Value 1K
SYMBOL voltage -112 400 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 15
SYMBOL current 672 272 M180
WINDOW 0 24 77 Left 2
WINDOW 3 24 0 Left 2
WINDOW 123 37 33 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName Ii
SYMATTR Value ""
SYMATTR Value2 AC {u(prb)}
SYMBOL voltage 480 176 M270
WINDOW 0 32 56 VTop 2
WINDOW 3 -32 56 VBottom 2
WINDOW 123 -32 56 VBottom 2
WINDOW 39 -32 56 VBottom 2
SYMATTR InstName Vi
SYMATTR Value ""
SYMATTR Value2 AC {u(-prb)}
FLAG -112 512 0
FLAG 80 192 0
FLAG -32 272 0
FLAG 1008 336 0
FLAG 144 128 +V
FLAG -112 400 +V
FLAG -224 512 0
FLAG -224 400 -V
FLAG 144 224 -V
FLAG 672 288 0
FLAG 672 176 x
TEXT 360 416 Left 2 !.ac dec 30 .1 100Meg
TEXT -8 -344 Left 2 ;Here the open loop gain is determined from the closed loop system[1].\nThe open loop gain can be plotted by plotting the quantity:\n \n-1/(1-1/(2*(I(Vi)@1*V(x)@2-V(x)@1*I(Vi)@2)+V(x)@1+I(Vi)@2))\n \nAlternatively, you add the following line to your plot.defs file:\n.func T.et.al() -1/(1-1/(2*(I(Vi)@1*V(x)@2-V(x)@1*I(Vi)@2)+V(x)@1+I(Vi)@2))\nAnd then plot simply T.et.al()\n \nThis is an improvement over the technique shown in LoopGain.asc \nbecause it (i) accounts for reverse feedback(it doesn't even\nmatter if you reverse the direction of the probe -- you still compute\nthe same open loop response) and (ii) the inserted probe elements\nresult in a smaller, sparser circuit matrix.
TEXT 432 584 Top 1 ;This example schematic is supplied for informational/educational purposes only.
TEXT -8 456 Left 2 ;[1] Michael Tian, V. Visvanathan, Jeffrey Hantgan, and Kenneth Kundert,\n    "Striving for Small-Signal Stability", IEEE Circuits and Devices Magazine,\n     vol. 17, no. 1, pp. 31-41, January 2001.
TEXT 360 384 Left 2 !.step param prb list -1 1 ; set prb=0 to turn off probe
TEXT 456 72 Left 2 ;Probe elements added to  inject\nsignals to measure the open loop\nresponse from the closed loop system
TEXT -328 560 Left 2 ;This example is based on posts contributed by Frank Wiedmann to the independent users' group at http://groups.yahoo.com/group/LTspice