* Z:\home\khalils\Downloads\files\data\raw_asc\f586b0d39f6f_peak-detector.asc
* Generated by LTspice 26.0.1 for Windows.
D2 N003 N004 BAS16HY
C1 N004 0 1n
R3 OUT 0 100Meg
R5 N006 0 100k
R4 N004 0 3.3Meg
C2 OUT 0 10n
R2 OUT N002 1k
XU2 N004 N002 VCC VEE N002 OPA1678 ;pnba In+)In-)V+)V-)OUT
R1 N002 N001 10k
XU1 N006 N001 VCC VEE N003 OPA1678 ;pnba In+)In-)V+)V-)OUT
D1 N001 N003 BAS16HY
V2 VEE 0 {-vcc} Rser=0.1
V1 VCC 0 {vcc} Rser=0.1
C3 N006 N005 100n
V3 N005 0 SINE(0 {in} 100k)
.model D D
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.dio
.tran 5m
.param vcc=3.3
.step dec param in 0.01 1 5
.meas out AVG V(OUT) FROM 4m
.meas TRAN ratio PARAM out/in
.lib opa1678.lib
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 2064 780
WIRE 416 -144 416 -160
WIRE 592 -144 592 -160
WIRE 416 -48 416 -64
WIRE 592 -48 592 -64
WIRE 864 48 672 48
WIRE 1008 48 864 48
WIRE 1216 48 1088 48
WIRE 1424 48 1216 48
WIRE 864 80 864 48
WIRE 1344 144 1344 128
WIRE 784 160 784 144
WIRE 1216 160 1216 48
WIRE 1312 160 1216 160
WIRE 672 176 672 48
WIRE 752 176 672 176
WIRE 1424 176 1424 48
WIRE 1424 176 1376 176
WIRE 1472 176 1424 176
WIRE 1584 176 1552 176
WIRE 1728 176 1584 176
WIRE 864 192 864 144
WIRE 864 192 816 192
WIRE 1008 192 864 192
WIRE 1136 192 1072 192
WIRE 1216 192 1136 192
WIRE 1312 192 1216 192
WIRE 1584 192 1584 176
WIRE 1728 192 1728 176
WIRE 544 208 368 208
WIRE 672 208 608 208
WIRE 752 208 672 208
WIRE 368 224 368 208
WIRE 1136 224 1136 192
WIRE 1216 224 1216 192
WIRE 1344 224 1344 208
WIRE 672 240 672 208
WIRE 784 240 784 224
WIRE 1584 288 1584 256
WIRE 1728 288 1728 272
WIRE 368 336 368 304
WIRE 672 336 672 320
WIRE 1136 336 1136 288
WIRE 1216 336 1216 304
SYMBOL diode 1008 208 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D2
SYMATTR Value BAS16HY
SYMBOL voltage 592 -160 R0
WINDOW 123 0 0 Left 0
WINDOW 39 24 126 Left 2
SYMATTR SpiceLine Rser=0.1
SYMATTR InstName V2
SYMATTR Value {-vcc}
SYMBOL cap 1120 224 R0
SYMATTR InstName C1
SYMATTR Value 1n
SYMBOL diode 848 80 R0
SYMATTR InstName D1
SYMATTR Value BAS16HY
SYMBOL Opamps\\opamp2 1344 112 R0
WINDOW 3 16 131 Left 2
SYMATTR Value OPA1678
SYMATTR InstName U2
SYMBOL res 1200 208 R0
SYMATTR InstName R4
SYMATTR Value 3.3Meg
SYMBOL cap 608 192 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C3
SYMATTR Value 100n
SYMBOL cap 1568 192 R0
SYMATTR InstName C2
SYMATTR Value 10n
SYMBOL res 656 224 R0
SYMATTR InstName R5
SYMATTR Value 100k
SYMBOL Opamps\\opamp2 784 128 R0
WINDOW 3 16 131 Left 2
SYMATTR Value OPA1678
SYMATTR InstName U1
SYMBOL voltage 368 208 R0
WINDOW 123 24 126 Left 2
WINDOW 39 24 156 Left 2
SYMATTR InstName V3
SYMATTR Value SINE(0 {in} 100k)
SYMBOL res 1104 32 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 10k
SYMBOL res 1712 176 R0
SYMATTR InstName R3
SYMATTR Value 100Meg
SYMBOL res 1568 160 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R2
SYMATTR Value 1k
SYMBOL voltage 416 -160 R0
WINDOW 3 26 98 Left 2
WINDOW 123 0 0 Left 0
WINDOW 39 24 126 Left 2
SYMATTR Value {vcc}
SYMATTR SpiceLine Rser=0.1
SYMATTR InstName V1
FLAG 416 -48 0
FLAG 592 -48 0
FLAG 416 -160 VCC
FLAG 592 -160 VEE
FLAG 784 144 VCC
FLAG 784 240 VEE
FLAG 1136 336 0
FLAG 1344 128 VCC
FLAG 1344 224 VEE
FLAG 1728 288 0
FLAG 1216 336 0
FLAG 368 336 0
FLAG 1728 176 OUT
FLAG 1584 288 0
FLAG 672 336 0
TEXT 408 480 Left 2 !.tran 5m
TEXT 408 544 Left 2 !.param vcc=3.3
TEXT 752 544 Left 2 !.step dec param in 0.01 1 5\n.meas out AVG V(OUT) FROM 4m\n.meas TRAN ratio PARAM out/in
TEXT 408 576 Left 2 !.lib opa1678.lib