* Z:\home\khalils\Downloads\files\data\raw_asc\LoopGain.asc
* Generated by LTspice 26.0.1 for Windows.
V1 +V 0 15
I1 0 N003 AC 1
V3 N003 N002 0
V4 N003 N004 0
R1 N004 0 100
R2 N001 0 1K
R3 N004 N001 1K
C1 N004 N001 3p
XU1 0 N001 +V -V N002 LT1001 ;pnba In+)In-)V+)V-)OUT
R5 N005 0 1K
R6 Y N005 1K
C2 Y N005 3p
V5 -V 0 -15
XU2 0 N005 +V -V X LT1001 ;pnba In+)In-)V+)V-)OUT
R4 Y 0 100
V2 Y X AC 1
.ac dec 30 .1 100Meg
* Elements added to \ncompute current gain\nGi=I(V3)/I(V4)
* Element added to \ncompute voltage gain\nGv=-V(x)/V(y)
* Here the open loop gain is determined from the closed loop system[1].\nThe voltage gain and current gain are independently measured in\ntwo circuits identical except for the elements inserted into\nthe loop to make the measurements. Then the open loop gain\ncan be plotted by plotting the quantity:\n \n((I(V3)/I(V4))*(-V(x)/V(y))-1)/((I(V3)/I(V4))+(-V(x)/V(y))+2)\n \nAlternatively, you can add the lines\n.func Gi()=I(V3)/I(V4)\n.func Gv()=-V(x)/V(y)\n.func middlebrook(x,y) = (x*y-1)/(x+y+2)\nto your plot.defs file and then plot the quantity\nmiddlebrook(Gi(),Gv())
* This example schematic is supplied for informational/educational purposes only.
* 1] Middlebrook, R.D., "Measurement of Loop Gain in Feedback Systems", Int. J. Electronics, vol 38, No. 4, pp. 485-512, 1975
* See the example file LoopGain2.asc for an improved technique.
* Library below included based on ModelFile attribute of instance XU1, XU2 (C:\users\khalils\AppData\Local\LTspice\lib\sym\OpAmps\LT1001.asy)
.lib LTC.lib
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 2168 1300
WIRE 384 80 384 64
WIRE 96 160 96 144
WIRE -80 176 -128 176
WIRE 64 176 -80 176
WIRE 288 192 128 192
WIRE 384 192 384 160
WIRE 384 192 368 192
WIRE 432 192 384 192
WIRE 624 192 512 192
WIRE -80 208 -80 176
WIRE 64 208 32 208
WIRE 96 240 96 224
WIRE 624 240 624 192
WIRE 688 240 624 240
WIRE 688 256 688 240
WIRE 144 304 48 304
WIRE 240 304 208 304
WIRE -80 320 -80 288
WIRE 688 352 688 336
WIRE -128 384 -128 176
WIRE 48 384 48 304
WIRE 48 384 -128 384
WIRE 80 384 48 384
WIRE 240 384 240 304
WIRE 240 384 160 384
WIRE 624 384 624 240
WIRE 624 384 240 384
WIRE -368 480 -368 464
WIRE -256 480 -256 464
WIRE 96 528 96 512
WIRE -80 544 -128 544
WIRE 64 544 -80 544
WIRE -80 560 -80 544
WIRE 352 560 128 560
WIRE 368 560 352 560
WIRE 480 560 448 560
WIRE 608 560 480 560
WIRE -368 576 -368 560
WIRE -256 576 -256 560
WIRE 64 576 32 576
WIRE 96 608 96 592
WIRE 608 608 608 560
WIRE 672 608 608 608
WIRE 672 624 672 608
WIRE -80 656 -80 640
WIRE 144 672 48 672
WIRE 240 672 208 672
WIRE 672 720 672 704
WIRE -128 752 -128 544
WIRE 48 752 48 672
WIRE 48 752 -128 752
WIRE 80 752 48 752
WIRE 240 752 240 672
WIRE 240 752 160 752
WIRE 608 752 608 608
WIRE 608 752 240 752
FLAG 384 64 0
FLAG -256 576 0
FLAG 32 208 0
FLAG -80 320 0
FLAG 688 352 0
FLAG 32 576 0
FLAG -80 656 0
FLAG 352 560 X
FLAG 480 560 Y
FLAG 96 144 +V
FLAG -256 464 +V
FLAG -368 576 0
FLAG -368 464 -V
FLAG 96 240 -V
FLAG 96 512 +V
FLAG 96 608 -V
FLAG 672 720 0
SYMBOL voltage -256 464 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 15
SYMBOL current 384 80 R0
WINDOW 38 39 48 Left 2
SYMATTR SpiceModel AC
SYMATTR InstName I1
SYMATTR Value 1
SYMBOL voltage 384 192 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName V3
SYMATTR Value 0
SYMBOL voltage 416 192 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 -32 56 VBottom 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V4
SYMATTR Value 0
SYMBOL res 672 240 R0
SYMATTR InstName R1
SYMATTR Value 100
SYMBOL res -96 192 R0
SYMATTR InstName R2
SYMATTR Value 1K
SYMBOL res 176 368 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R3
SYMATTR Value 1K
SYMBOL cap 208 288 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C1
SYMATTR Value 3p
SYMBOL Opamps\\LT1001 96 128 R0
WINDOW 0 27 42 Left 2
WINDOW 3 25 87 Left 2
SYMATTR InstName U1
SYMBOL res -96 544 R0
SYMATTR InstName R5
SYMATTR Value 1K
SYMBOL res 176 768 M270
WINDOW 0 32 56 VTop 2
WINDOW 3 0 56 VBottom 2
SYMATTR InstName R6
SYMATTR Value 1K
SYMBOL cap 208 688 M270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName C2
SYMATTR Value 3p
SYMBOL voltage -368 464 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V5
SYMATTR Value -15
SYMBOL Opamps\\LT1001 96 496 R0
WINDOW 0 27 42 Left 2
WINDOW 3 25 87 Left 2
SYMATTR InstName U2
SYMBOL res 656 608 R0
SYMATTR InstName R4
SYMATTR Value 100
SYMBOL voltage 464 560 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
WINDOW 38 60 56 VTop 2
SYMATTR InstName V2
SYMATTR Value 1
SYMATTR SpiceModel AC
TEXT -376 672 Left 2 !.ac dec 30 .1 100Meg
TEXT 272 -40 Left 2 ;Elements added to \ncompute current gain\nGi=I(V3)/I(V4)
TEXT 288 416 Left 2 ;Element added to \ncompute voltage gain\nGv=-V(x)/V(y)
TEXT -456 -272 Left 2 ;Here the open loop gain is determined from the closed loop system[1].\nThe voltage gain and current gain are independently measured in\ntwo circuits identical except for the elements inserted into\nthe loop to make the measurements.  Then the open loop gain\ncan be plotted by plotting the quantity:\n \n((I(V3)/I(V4))*(-V(x)/V(y))-1)/((I(V3)/I(V4))+(-V(x)/V(y))+2)\n \nAlternatively, you can add the lines\n.func Gi()=I(V3)/I(V4)\n.func Gv()=-V(x)/V(y)\n.func middlebrook(x,y) = (x*y-1)/(x+y+2)\nto your plot.defs file and then plot the quantity\nmiddlebrook(Gi(),Gv())
TEXT 200 864 Top 1 ;This example schematic is supplied for informational/educational purposes only.
TEXT -544 808 Left 2 ;1] Middlebrook, R.D., "Measurement of Loop Gain in Feedback Systems", Int. J. Electronics, vol 38, No. 4, pp. 485-512, 1975
TEXT -368 848 Left 2 ;See the example file LoopGain2.asc for an improved technique.
LINE Normal 524 258 524 33
LINE Normal 274 258 524 258
LINE Normal 274 33 524 33
LINE Normal 274 258 274 33
LINE Normal 285 491 535 491
LINE Normal 285 649 535 649
LINE Normal 535 649 535 491
LINE Normal 285 649 285 491