* Z:\home\khalils\Downloads\files\data\raw_asc\0b4bb343f8e3_LoopGain_Probe_LT1078.asc
* Generated by LTspice 26.0.1 for Windows.
* 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
* This is exactly a copy from Frank Wiedmann's loopgain work.\nThanks Frank for your example.\n \nIf a single supply is used, especially take care of the input and \noutput voltage. The opamp has no gain if the output is at 0V.\nPlot this: ((I(V3)/I(V4))*(-V(x)/V(y))-1)/((I(V3)/I(V4))+(-V(x)/V(y))+2)
* Library below included based on ModelFile attribute of instance XU1, XU2 (C:\users\khalils\AppData\Local\LTspice\lib\sym\OpAmps\LT1078A.asy)
XU1 offs N001 +V -V N002 LT1078 ;pnba In+)In-)V+)V-)OUT
V2 Y X AC 1
R1 N003 0 10k
R2 N001 0 1K
V1 +V 0 5
C2 Y N004 3p
V3 Z N002 0
V4 Z N003 0
R3 N003 N001 1k
R5 N004 0 1K
R6 Y N004 1k
R4 Y 0 10k
I1 0 Z AC 1
V6 offs 0 0.1
V5 -V 0 0
XU2 offs N004 +V -V X LT1078 ;pnba In+)In-)V+)V-)OUT
C1 N003 N001 3p
.ac dec 30 .01 100Meg
.lib LTC.lib
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 2412 1728
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 400 192 384 192
WIRE 432 192 400 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 -368 288 -368 272
WIRE 144 304 48 304
WIRE 240 304 208 304
WIRE -80 320 -80 288
WIRE 688 352 688 336
WIRE -368 384 -368 368
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
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
SYMBOL voltage 416 192 R270
WINDOW 0 32 56 VTop 0
WINDOW 3 -32 56 VBottom 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V4
SYMATTR Value 0
SYMBOL voltage -368 272 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V6
SYMATTR Value 0.1
SYMBOL voltage -256 464 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL res -96 192 R0
SYMATTR InstName R2
SYMATTR Value 1K
SYMBOL res 672 240 R0
SYMATTR InstName R1
SYMATTR Value 10k
SYMBOL voltage 384 192 R90
WINDOW 0 -32 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName V3
SYMATTR Value 0
SYMBOL res -96 544 R0
SYMATTR InstName R5
SYMATTR Value 1K
SYMBOL cap 208 688 M270
WINDOW 0 32 32 VTop 0
WINDOW 3 0 32 VBottom 0
SYMATTR InstName C2
SYMATTR Value 3p
SYMBOL voltage 464 560 R90
WINDOW 0 -32 56 VBottom 0
WINDOW 3 32 56 VTop 0
WINDOW 38 60 56 VTop 0
SYMATTR InstName V2
SYMATTR Value 1
SYMATTR SpiceModel AC
SYMBOL current 384 80 R0
WINDOW 38 39 48 Left 0
SYMATTR SpiceModel AC
SYMATTR InstName I1
SYMATTR Value 1
SYMBOL Opamps\\LT1078A 96 128 R0
SYMATTR InstName U1
SYMBOL res 176 368 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R3
SYMATTR Value 1k
SYMBOL cap 208 288 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName C1
SYMATTR Value 3p
SYMBOL res 656 608 R0
SYMATTR InstName R4
SYMATTR Value 10k
SYMBOL Opamps\\LT1078A 96 496 R0
SYMATTR InstName U2
SYMBOL res 176 768 M270
WINDOW 0 32 56 VTop 0
WINDOW 3 0 56 VBottom 0
SYMATTR InstName R6
SYMATTR Value 1k
SYMBOL voltage -368 464 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V5
SYMATTR Value 0
FLAG 384 64 0
FLAG -256 576 0
FLAG -80 320 0
FLAG 688 352 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
FLAG 400 192 Z
FLAG 32 208 offs
FLAG 32 576 offs
FLAG -368 384 0
FLAG -368 272 offs
TEXT -376 672 Left 0 !.ac dec 30 .01 100Meg
TEXT 272 -40 Left 0 ;Elements added to \ncompute current gain\nGi=I(V3)/I(V4)
TEXT 288 416 Left 0 ;Element added to \ncompute voltage gain\nGv=-V(x)/V(y)
TEXT -456 -272 Left 0 ;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 -304 840 Left 0 ;This example schematic is supplied for informational/educational purposes only.
TEXT -544 808 Left 0 ;1] Middlebrook, R.D., "Measurement of Loop Gain in Feedback Systems", Int. J. Electronics, vol 38, No. 4, pp. 485-512, 1975
TEXT -456 -496 Left 0 ;This is exactly a copy from Frank Wiedmann's loopgain work.\nThanks Frank for your example.\n \nIf a single supply is used, especially take care of the input and \noutput voltage. The opamp has no gain if the output is at 0V.\nPlot this:  ((I(V3)/I(V4))*(-V(x)/V(y))-1)/((I(V3)/I(V4))+(-V(x)/V(y))+2)