* Z:\home\khalils\Downloads\files\data\raw_asc\MonteCarlo.asc
* Generated by LTspice 26.0.1 for Windows.
* Monte Carlo Simulation in LTspice
* mc(val, tol) is a function that uses a random number generator \n to return a value between val-tol*val and val+tol*val\n \nOther functions of interest:\n \nflat(x): a function that uses a random number generator \n to return a value between -x and x;\n \ngauss(x): a function that uses a random number generator \n to return a value with a Gaussian distribution\n and sigma x.
* This example schematic is supplied for informational/educational purposes only.
R2 0 OUT 141
L2 N001 0 {mc(10u, tol)}
V1 IN 0 AC 1
L1 OUT 0 {mc(10u, tol)}
C2 N001 0 {mc(1n, tol)}
C3 OUT N002 {mc(250p, tol)}
R1 N001 IN 141
L3 N002 N001 {mc(40u, tol)}
C1 OUT 0 {mc(1n, tol)}
.ac oct 100 300K 10Meg
.step param X 0 20 1 ; a dummy paramter to cycle Monte Carlo runs
.param tol=.05 ; +/- 5% component tolerance
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 1516 692
WIRE -288 -496 -448 -496
WIRE -96 -496 -208 -496
WIRE -32 -496 -96 -496
WIRE 112 -496 -32 -496
WIRE 320 -496 192 -496
WIRE 544 -496 384 -496
WIRE 624 -496 544 -496
WIRE 848 -496 624 -496
WIRE -448 -480 -448 -496
WIRE -96 -480 -96 -496
WIRE -32 -480 -32 -496
WIRE 544 -480 544 -496
WIRE 624 -480 624 -496
WIRE 848 -480 848 -496
WIRE -448 -384 -448 -400
WIRE -96 -384 -96 -400
WIRE -32 -384 -32 -416
WIRE 544 -384 544 -400
WIRE 624 -384 624 -416
WIRE 848 -384 848 -400
SYMBOL ind 560 -496 M0
SYMATTR InstName L1
SYMATTR Value {mc(10u, tol)}
SYMBOL cap 384 -512 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C3
SYMATTR Value {mc(250p, tol)}
SYMBOL res -192 -512 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 141
SYMBOL cap -48 -480 R0
SYMATTR InstName C2
SYMATTR Value {mc(1n, tol)}
SYMBOL voltage -448 -496 R0
SYMATTR InstName V1
SYMATTR Value AC 1
SYMBOL ind 208 -480 M270
WINDOW 0 32 56 VTop 2
WINDOW 3 5 56 VBottom 2
SYMATTR InstName L3
SYMATTR Value {mc(40u, tol)}
SYMBOL res 832 -384 M180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName R2
SYMATTR Value 141
SYMBOL ind -80 -496 M0
SYMATTR InstName L2
SYMATTR Value {mc(10u, tol)}
SYMBOL cap 608 -480 R0
SYMATTR InstName C1
SYMATTR Value {mc(1n, tol)}
FLAG 624 -384 0
FLAG -448 -384 0
FLAG 544 -384 0
FLAG -32 -384 0
FLAG -96 -384 0
FLAG 848 -384 0
FLAG 848 -496 OUT
FLAG -448 -496 IN
TEXT -408 -264 Left 2 !.ac oct 100 300K 10Meg
TEXT -408 -296 Left 2 !.step param X 0 20 1 ; a dummy paramter to cycle Monte Carlo runs
TEXT -408 -328 Left 2 !.param tol=.05 ; +/- 5% component tolerance
TEXT 200 -544 Bottom 2 ;Monte Carlo Simulation in LTspice
TEXT -56 -232 Left 2 ;mc(val, tol) is a function that uses a random number generator \n                     to return a value between val-tol*val and val+tol*val\n \nOther functions of interest:\n \nflat(x): a function that uses a random number generator \n         to return a value between -x and x;\n \ngauss(x): a function that uses a random number generator \n          to return a value with a Gaussian distribution\n          and sigma x.
TEXT 192 88 Top 1 ;This example schematic is supplied for informational/educational purposes only.