Update example nutmeg_script

This commit is contained in:
ivandi 2024-01-20 14:12:58 -05:00
parent 457e7ac3bf
commit 622ef9410e

View File

@ -1,6 +1,6 @@
<Qucs Schematic 24.1.0>
<Properties>
<View=146,70,1657,930,1,0,0>
<View=30,-25,1348,2472,0.357629,0,0>
<Grid=10,10,1>
<DataSet=nutmeg_script.dat>
<DataDisplay=nutmeg_script.dpl>
@ -16,33 +16,264 @@
<Symbol>
</Symbol>
<Components>
<Vac V1 1 200 210 18 -26 0 1 "1 V" 1 "1 kHz" 0 "0" 0 "0" 0 "0" 0 "0" 0>
<C C1 1 270 140 -26 17 0 0 "1 nF" 1 "" 0 "neutral" 0>
<L L1 1 370 140 -26 10 0 0 "1 mH" 1 "" 0>
<GND * 1 440 240 0 0 0 0>
<GND * 1 200 240 0 0 0 0>
<R R1 1 440 210 15 -26 0 1 "1 kOhm" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<.CUSTOMSIM CUSTOM1 1 200 290 0 51 0 0 "\nAC DEC 100 1K 10MEG\nlet K=V(out)/V(in)\n\n* Extra output\n* A custom prefix could be placed between # #\n* It will be prepended to all dataset variables\nwrite custom#ac1#.plot K\n\n* Scalars can be printed\n* They will be available in the dataset\nlet Vout_max=vecmax(V(out))\nlet KdB_max=db(vecmax(K))\nprint Vout_max KdB_max > custom#ac1#.print\n" 1 "V(out);V(in)" 0 "custom#ac1#.plot;custom#ac1#.print" 0>
<_BJT KT3102A_1 1 360 320 8 -26 0 0 "npn" 0 "5.258f" 0 "1" 0 "1" 0 "0.4922" 0 "0.25" 0 "86" 0 "25" 0 "28.21n" 0 "7.428" 0 "21.2p" 0 "2" 0 "185.1" 0 "2.713" 0 "0" 0 "0" 0 "1.65" 0 "0" 0 "52" 0 "11.3p" 0 "0.69" 0 "0.33" 0 "9.921p" 0 "0.65" 0 "0.33" 0 "1" 0 "0" 0 "0.75" 0 "0" 0 "0.5" 0 "611.5p" 0 "2" 0 "80" 0 "0.52" 0 "57.71n" 0 "26.85" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1.5" 0 "3" 0 "1.11" 0 "26.85" 0 "1" 0>
<_BJT KT3102A_2 1 910 280 8 -26 0 0 "npn" 0 "5.258f" 0 "1" 0 "1" 0 "0.4922" 0 "0.25" 0 "86" 0 "25" 0 "28.21n" 0 "7.428" 0 "21.2p" 0 "2" 0 "185.1" 0 "2.713" 0 "0" 0 "0" 0 "1.65" 0 "0" 0 "52" 0 "11.3p" 0 "0.69" 0 "0.33" 0 "9.921p" 0 "0.65" 0 "0.33" 0 "1" 0 "0" 0 "0.75" 0 "0" 0 "0.5" 0 "611.5p" 0 "2" 0 "80" 0 "0.52" 0 "57.71n" 0 "26.85" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1.5" 0 "3" 0 "1.11" 0 "26.85" 0 "1" 0>
<_BJT KT815B_1 1 990 640 8 -26 0 0 "npn" 0 "10.2f" 0 "1" 0 "1" 0 "0.3983" 0 "0.3633" 0 "87" 0 "0" 0 "573.7f" 0 "1.453" 0 "231.6f" 0 "1.44" 0 "159.4" 0 "1.576" 0 "0" 0 "0" 0 "0.2936" 0 "0" 0 "5" 0 "71.14p" 0 "0.75" 0 "0.3333" 0 "88.73p" 0 "0.75" 0 "0.3333" 0 "1" 0 "0" 0 "0.75" 0 "0" 0 "0.5" 0 "24.32n" 0 "2" 0 "10" 0 "1" 0 "2.046u" 0 "26.85" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1.5" 0 "3" 0 "1.11" 0 "26.85" 0 "1" 0>
<R R1 1 360 220 -57 -17 0 1 "1k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R2 1 360 710 15 -26 0 1 "1k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<_BJT KT815A_1 1 700 590 8 -26 0 0 "npn" 0 "10.2f" 0 "1" 0 "1" 0 "0.4139" 0 "0.5592" 0 "70" 0 "0" 0 "349.5f" 0 "1.422" 0 "706.1f" 0 "1.473" 0 "191.7" 0 "1.683" 0 "0" 0 "0" 0 "0.203" 0 "0" 0 "5" 0 "71.14p" 0 "0.75" 0 "0.3333" 0 "88.73p" 0 "0.75" 0 "0.3333" 0 "1" 0 "0" 0 "0.75" 0 "0" 0 "0.5" 0 "24.32n" 0 "2" 0 "10" 0 "1" 0 "2.046u" 0 "26.85" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1.5" 0 "3" 0 "1.11" 0 "26.85" 0 "1" 0>
<R R3 1 260 420 -22 -51 0 2 "1k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R4 1 370 420 -19 -54 0 2 "27k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<_BJT KT814B_1 1 1020 230 9 -9 1 0 "pnp" 0 "11.45f" 0 "1" 0 "1" 0 "0.2157" 0 "0.5927" 0 "72.62" 0 "0" 0 "97.57f" 0 "1.421" 0 "637.6f" 0 "1.41" 0 "128.7" 0 "1.928" 0 "0" 0 "0" 0 "0.2979" 0 "0" 0 "4" 0 "71.14p" 0 "0.75" 0 "0.3333" 0 "88.73p" 0 "0.75" 0 "0.3333" 0 "1" 0 "0" 0 "0.75" 0 "0" 0 "0.5" 0 "26.36n" 0 "5" 0 "10" 0 "3" 0 "2.046u" 0 "26.85" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1.5" 0 "3" 0 "1.11" 0 "26.85" 0 "1" 0>
<_BJT KT3107A_1 1 360 620 8 -26 1 0 "pnp" 0 "6.545f" 0 "1" 0 "1" 0 "0.1862" 0 "12m" 0 "86.5" 0 "32" 0 "7.735n" 0 "8.56" 0 "3.35p" 0 "2" 0 "105.5" 0 "1.62" 0 "0" 0 "0" 0 "0.71" 0 "0" 0 "39.1" 0 "12.59p" 0 "0.69" 0 "0.35" 0 "12.83p" 0 "0.65" 0 "0.33" 0 "1" 0 "0" 0 "0.75" 0 "0" 0 "0.5" 0 "477.5p" 0 "2" 0 "35" 0 "56m" 0 "30.5n" 0 "26.85" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1.5" 0 "3" 0 "1.11" 0 "26.85" 0 "1" 0>
<R R30 1 850 560 -26 15 0 0 "120" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R29 1 850 280 -23 -49 0 0 "120" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R18 1 910 340 15 -26 0 1 "68" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R20 1 1020 360 15 -26 1 3 "0.39" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<C C4 1 820 150 17 -26 0 1 "500u" 1 "" 0 "neutral" 0>
<R R19 1 990 310 -26 -43 0 2 "120" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R22 1 960 530 -31 -55 0 0 "120" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R23 1 990 480 15 -26 0 1 "0.39" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R16 1 870 100 -27 -51 1 0 "330" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<GND * 1 400 420 0 0 0 1>
<GND * 1 400 480 0 0 0 1>
<R R5 1 440 220 14 -18 0 1 "15k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<_BJT KT814A_1 1 690 240 8 -9 1 0 "pnp" 0 "11.45f" 0 "1" 0 "1" 0 "0.3656" 0 "1.275" 0 "62.37" 0 "0" 0 "88.24f" 0 "1.411" 0 "269.4f" 0 "1.51" 0 "176.8" 0 "1.238" 0 "0" 0 "0" 0 "0.1654" 0 "0" 0 "4" 0 "71.14p" 0 "0.75" 0 "0.33" 0 "88.73p" 0 "0.75" 0 "0.3333" 0 "1" 0 "0" 0 "0.75" 0 "0" 0 "0.5" 0 "26.36n" 0 "5" 0 "10" 0 "3" 0 "2.046u" 0 "26.85" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1.5" 0 "3" 0 "1.11" 0 "26.85" 0 "1" 0>
<R R13 1 690 140 17 -15 0 1 "120" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R11 1 600 190 -53 -20 0 1 "39" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<C C3 1 600 130 -67 -20 0 1 "22n" 1 "" 0 "neutral" 0>
<GND * 1 820 180 0 0 0 0>
<R R12 1 600 640 15 -26 0 1 "39" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<C C2 1 600 700 17 -26 0 1 "22n" 1 "" 0 "neutral" 0>
<R R14 1 700 680 15 -26 0 1 "120" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<C C5 1 820 740 17 -26 0 1 "500u" 1 "" 0 "neutral" 0>
<GND * 1 820 710 0 0 0 2>
<GND * 1 910 370 0 0 0 0>
<GND * 1 910 470 0 0 0 2>
<_BJT KT819A_1 1 1140 670 8 -26 0 0 "npn" 0 "114.5f" 0 "1" 0 "1" 0 "3.193" 0 "0.4086" 0 "80" 0 "0" 0 "1.231p" 0 "1.371" 0 "1.185p" 0 "1.533" 0 "176.5" 0 "1" 0 "0" 0 "0" 0 "36.34m" 0 "0" 0 "2" 0 "1.635n" 0 "0.75" 0 "0.3333" 0 "1.183n" 0 "0.75" 0 "0.3333" 0 "1" 0 "0" 0 "0.75" 0 "0" 0 "0.5" 0 "14.69n" 0 "0.4251" 0 "10" 0 "1.387" 0 "2.955u" 0 "26.85" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1.5" 0 "3" 0 "1.11" 0 "26.85" 0 "1" 0>
<_BJT KT818A_1 1 1150 190 8 -26 1 0 "pnp" 0 "150.1f" 0 "1" 0 "1" 0 "6.563" 0 "0.24" 0 "70" 0 "0" 0 "2.436p" 0 "1.37" 0 "2.847p" 0 "1.564" 0 "135.8" 0 "1.6" 0 "0" 0 "0" 0 "74m" 0 "0" 0 "1" 0 "1.635n" 0 "0.75" 0 "0.3333" 0 "1.183n" 0 "0.75" 0 "0.3333" 0 "1" 0 "0" 0 "0.75" 0 "0" 0 "0.5" 0 "20.02n" 0 "0.8299" 0 "10" 0 "0.3063" 0 "2.65u" 0 "26.85" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1.5" 0 "3" 0 "1.11" 0 "26.85" 0 "1" 0>
<R R28 1 1090 190 -18 -50 0 2 "2" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R32 1 1110 420 -26 15 0 0 "8" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<GND * 1 120 520 0 0 0 0>
<Vdc V2 1 1250 750 18 -26 0 1 "25" 1>
<Vdc V3 1 1260 180 18 -26 0 1 "25" 1>
<GND * 1 1260 210 0 0 0 0>
<GND * 1 1250 720 0 0 0 2>
<R R24 1 910 670 -55 -15 0 1 "1k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R31 1 910 170 16 -16 0 1 "1k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R26 1 1020 130 15 -26 0 1 "68" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R27 1 1080 670 -12 17 0 2 "2" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R25 1 990 730 15 -26 0 1 "68" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R17 1 870 780 -26 15 0 0 "330" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<_BJT KT3107A_2 1 910 560 8 -26 1 0 "pnp" 0 "6.545f" 0 "1" 0 "1" 0 "0.1862" 0 "12m" 0 "86.5" 0 "32" 0 "7.735n" 0 "8.56" 0 "3.35p" 0 "2" 0 "105.5" 0 "1.62" 0 "0" 0 "0" 0 "0.71" 0 "0" 0 "39.1" 0 "12.59p" 0 "0.69" 0 "0.35" 0 "12.83p" 0 "0.65" 0 "0.33" 0 "1" 0 "0" 0 "0.75" 0 "0" 0 "0.5" 0 "477.5p" 0 "2" 0 "35" 0 "56m" 0 "30.5n" 0 "26.85" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1" 0 "1" 0 "0" 0 "1.5" 0 "3" 0 "1.11" 0 "26.85" 0 "1" 0>
<R R7 1 550 450 -24 -52 1 0 "68" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R9 1 640 390 15 -26 0 1 "10k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<GND * 1 520 450 0 0 0 3>
<R R6 1 480 720 15 -26 0 1 "15k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<R R33 1 760 530 15 -26 0 1 "15" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<Diode D2D212A_1 1 760 470 13 -26 0 1 "36.89f" 0 "1" 0 "21p" 0 "0.3333" 0 "0.75" 0 "0.5" 0 "0" 0 "0" 0 "2" 0 "0" 0 "150n" 0 "0" 0 "0" 0 "1" 0 "1" 0 "200" 0 "50u" 0 "26.85" 0 "3" 0 "1.11" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "26.85" 0 "1" 0 "normal" 0>
<R R21 1 910 500 -53 -20 0 3 "68" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<GND * 1 250 220 0 0 0 0>
<Diode D814D_1 1 240 750 -59 -26 0 3 "5.235e-13" 0 "1.17" 0 "29.15p" 0 "0.41" 0 "0.71" 0 "0.5" 0 "0" 0 "0" 0 "2" 0 "3.8" 0 "59.96n" 0 "0" 0 "0" 0 "1" 0 "1" 0 "13" 0 "1u" 0 "26.85" 0 "3" 0 "1.11" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "26.85" 0 "1" 0 "normal" 0>
<Diode D814D_4 1 250 130 -59 -26 0 3 "5.235e-13" 0 "1.17" 0 "29.15p" 0 "0.41" 0 "0.71" 0 "0.5" 0 "0" 0 "0" 0 "2" 0 "3.8" 0 "59.96n" 0 "0" 0 "0" 0 "1" 0 "1" 0 "13" 0 "1u" 0 "26.85" 0 "3" 0 "1.11" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "26.85" 0 "1" 0 "normal" 0>
<GND * 1 240 660 0 0 0 2>
<Diode KS139A_1 1 250 190 -64 -26 0 3 "4e-13" 0 "1.35" 0 "85p" 0 "0.45" 0 "0.8" 0 "0.5" 0 "0" 0 "0" 0 "2" 0 "30" 0 "72n" 0 "0" 0 "0" 0 "1" 0 "1" 0 "3.9" 0 "5u" 0 "26.85" 0 "3" 0 "1.11" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "26.85" 0 "1" 0 "normal" 0>
<Diode KS139A_2 1 240 690 -64 -26 0 3 "4e-13" 0 "1.35" 0 "85p" 0 "0.45" 0 "0.8" 0 "0.5" 0 "0" 0 "0" 0 "2" 0 "30" 0 "72n" 0 "0" 0 "0" 0 "1" 0 "1" 0 "3.9" 0 "5u" 0 "26.85" 0 "3" 0 "1.11" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "26.85" 0 "1" 0 "normal" 0>
<GND * 1 710 300 0 0 0 3>
<R R34 1 710 390 15 -26 0 1 "10" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<C C1 1 370 480 -26 17 0 0 "1000p" 1 "" 0 "neutral" 0>
<C C12 1 1140 810 17 -26 0 1 "33n" 1 "" 0 "neutral" 0>
<GND * 1 1140 840 0 0 0 0>
<GND * 1 1020 40 0 0 0 2>
<C C11 1 1020 70 17 -26 0 1 "33n" 1 "" 0 "neutral" 0>
<C C9 1 710 330 -54 -26 1 1 "68n" 1 "" 0 "neutral" 0>
<C C6 1 580 380 -76 -24 1 1 "500u" 1 "" 0 "neutral" 0>
<C C7 1 580 510 -69 -15 1 1 "500u" 1 "" 0 "neutral" 0>
<R R8 1 610 450 -19 -52 1 0 "1k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<C C10 1 800 380 17 -26 0 1 "33n" 1 "" 0 "neutral" 0>
<Diode D2D212A_2 1 760 350 13 -26 0 1 "36.89f" 0 "1" 0 "21p" 0 "0.3333" 0 "0.75" 0 "0.5" 0 "0" 0 "0" 0 "2" 0 "0" 0 "150n" 0 "0" 0 "0" 0 "1" 0 "1" 0 "200" 0 "50u" 0 "26.85" 0 "3" 0 "1.11" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "26.85" 0 "1" 0 "normal" 0>
<R R10 1 640 530 15 -26 0 1 "10k" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "european" 0>
<C C13 1 710 440 -26 17 0 0 "1000p" 1 "" 0 "neutral" 0>
<GND * 1 1160 440 0 0 0 0>
<C C8 1 190 420 -25 -56 0 0 "10u" 1 "" 0 "neutral" 0>
<.CUSTOMSIM OP1 1 130 870 0 51 0 0 "\nop\nprint output i(v2) i(v3) > custom#op1#.print\ndestroy all\n" 1 "" 0 "custom#op1#.print" 0>
<.CUSTOMSIM AC1 1 130 1070 0 51 0 0 "\nac dec 100 1 1meg\nwrite custom#ac1#.plot v(output)\ndestroy all\n" 1 "" 0 "custom#ac1#.plot" 0>
<.CUSTOMSIM TRAN1 1 130 1290 0 51 0 0 "\ntran 1u 10m\nwrite custom#tran1#.plot v(output)\ndestroy all" 1 "" 0 "custom#tran1#.plot" 0>
<.CUSTOMSIM AC2 1 710 1060 0 51 0 0 "\nac lin 100 10k 110k\nwrite custom#ac2#.plot v(output)\ndestroy all\n" 1 "" 0 "custom#ac2#.plot" 0>
<.CUSTOMSIM TRAN2 1 710 1290 0 51 0 0 "\ntran 1u 10m 9m\nwrite custom#tran2#.plot v(output)\ndestroy all" 1 "" 0 "custom#tran2#.plot" 0>
<.CUSTOMSIM FOUR1 1 130 1510 0 51 0 0 "\ntran 25u 25m\nlinearize v(output)\nfft v(output)\nwrite custom#four1#.plot v(output)\ndestroy all" 1 "" 0 "custom#four1#.plot" 0>
<.CUSTOMSIM FOUR2 1 710 1510 0 51 0 0 "\ntran 100u 100m\nlinearize v(output)\nfft v(output)\nwrite custom#four2#.plot v(output)\ndestroy all" 1 "" 0 "custom#four2#.plot" 0>
<.CUSTOMSIM NOISE1 1 130 1750 0 51 0 0 "\nnoise v(output) v1 dec 100 1 10meg\nsetplot noise1\nwrite custom#noise1#.plot onoise_spectrum inoise_spectrum\nsetplot noise2\nprint onoise_total inoise_total > custom#noise1#.print\ndestroy all" 1 "" 0 "custom#noise1#.plot;custom#noise1#.print" 0>
<S4Q_V V1 1 120 490 -10 62 0 1 "DC 0 AC {Vin}" 1 "+ SIN(0 {Vin} {Fin})" 1 "+ DISTOF1 {Vin}" 1 "" 0 "" 0>
<SpicePar SpicePar1 5 200 480 -27 18 0 0 "Vin=1" 1 "Fin=1k" 1>
<.CUSTOMSIM DISTO2 1 750 1990 0 51 0 0 "\ndisto lin 1000 20 20k\nlet h2=disto1.v(output)\nlet h3=disto2.v(output)\nwrite custom#disto2#.plot h2 h3\ndestroy all\n" 1 "" 0 "custom#disto2#.plot" 0>
<.CUSTOMSIM DISTO1 1 130 1990 0 51 0 0 "\ndisto dec 100 10 100k\nlet h2=disto1.v(output)\nlet h3=disto2.v(output)\nwrite custom#disto1#.plot h2 h3\ndestroy all\n" 1 "" 0 "custom#disto1#.plot" 0>
<.CUSTOMSIM THD1 1 130 2230 0 51 0 0 "\ncompose vin_v values 1 1.5 1.8 2 2.5\nlet n = length(vin_v)\nlet thd_v = vector(n)\n\nlet i = 0\nrepeat $&n\n let vin_i = vin_v[i]\n alterparam vin = $&vin_i\n reset\n\n tran 1u 10m\n fourier 1k v(output)\n\n let j = 2\n let sum_i = 0\n let f = i + 1\n while j < 10\n let sum_i = sum_i + fourier{$&f}1[1][j] ^ 2\n let j = j + 1\n end\n let thd_i = 100 * sqrt(sum_i) / fourier{$&f}1[1][1]\n let thd_v[i] = thd_i\n\n destroy $curplot\n let i = i + 1\nend\n\nsetscale vin_v\nwrite custom#thd1#.plot thd_v\n\ndestroy all\nreset" 1 "" 0 "custom#thd1#.plot" 0>
</Components>
<Wires>
<200 140 200 180 "" 0 0 0 "">
<200 140 240 140 "" 0 0 0 "">
<300 140 340 140 "" 0 0 0 "">
<400 140 440 140 "" 0 0 0 "">
<440 140 440 180 "" 0 0 0 "">
<200 140 200 140 "in" 230 110 0 "">
<440 140 440 140 "out" 470 110 0 "">
<1020 160 1020 190 "" 0 0 0 "">
<1020 190 1020 200 "" 0 0 0 "">
<910 200 910 230 "" 0 0 0 "">
<910 230 910 250 "" 0 0 0 "">
<910 230 990 230 "" 0 0 0 "">
<910 310 960 310 "" 0 0 0 "">
<1020 260 1020 310 "" 0 0 0 "">
<1020 310 1020 330 "" 0 0 0 "">
<360 100 360 190 "" 0 0 0 "">
<360 100 440 100 "" 0 0 0 "">
<820 100 840 100 "" 0 0 0 "">
<820 100 820 120 "" 0 0 0 "">
<600 100 690 100 "" 0 0 0 "">
<690 100 820 100 "" 0 0 0 "">
<290 320 290 420 "" 0 0 0 "">
<290 320 330 320 "" 0 0 0 "">
<290 620 330 620 "" 0 0 0 "">
<290 420 290 480 "" 0 0 0 "">
<290 420 340 420 "" 0 0 0 "">
<290 480 290 620 "" 0 0 0 "">
<290 480 340 480 "" 0 0 0 "">
<360 570 360 590 "" 0 0 0 "">
<360 570 440 570 "" 0 0 0 "">
<440 100 600 100 "" 0 0 0 "">
<440 100 440 190 "" 0 0 0 "">
<440 250 440 570 "" 0 0 0 "">
<360 250 360 280 "" 0 0 0 "">
<360 650 360 680 "" 0 0 0 "">
<360 350 480 350 "" 0 0 0 "">
<360 280 360 290 "" 0 0 0 "">
<600 240 600 280 "" 0 0 0 "">
<360 280 600 280 "" 0 0 0 "">
<690 100 690 110 "" 0 0 0 "">
<690 170 690 210 "" 0 0 0 "">
<600 240 660 240 "" 0 0 0 "">
<600 220 600 240 "" 0 0 0 "">
<690 280 760 280 "" 0 0 0 "">
<690 270 690 280 "" 0 0 0 "">
<600 590 600 610 "" 0 0 0 "">
<600 590 670 590 "" 0 0 0 "">
<360 740 360 780 "" 0 0 0 "">
<360 780 480 780 "" 0 0 0 "">
<820 780 840 780 "" 0 0 0 "">
<820 770 820 780 "" 0 0 0 "">
<700 780 820 780 "" 0 0 0 "">
<700 710 700 780 "" 0 0 0 "">
<700 620 700 650 "" 0 0 0 "">
<600 780 700 780 "" 0 0 0 "">
<600 730 600 780 "" 0 0 0 "">
<480 780 600 780 "" 0 0 0 "">
<700 560 760 560 "" 0 0 0 "">
<660 420 710 420 "" 0 0 0 "">
<1020 390 1020 420 "" 0 0 0 "">
<990 420 1020 420 "" 0 0 0 "">
<990 420 990 450 "" 0 0 0 "">
<910 530 930 530 "" 0 0 0 "">
<990 530 990 610 "" 0 0 0 "">
<990 510 990 530 "" 0 0 0 "">
<910 590 910 640 "" 0 0 0 "">
<910 640 960 640 "" 0 0 0 "">
<910 700 910 780 "" 0 0 0 "">
<900 780 910 780 "" 0 0 0 "">
<990 670 1050 670 "" 0 0 0 "">
<990 670 990 700 "" 0 0 0 "">
<900 100 910 100 "" 0 0 0 "">
<910 100 1020 100 "" 0 0 0 "">
<910 100 910 140 "" 0 0 0 "">
<910 780 990 780 "" 0 0 0 "">
<990 760 990 780 "" 0 0 0 "">
<1020 190 1060 190 "" 0 0 0 "">
<1150 100 1150 160 "" 0 0 0 "">
<1150 220 1150 310 "" 0 0 0 "">
<1020 310 1150 310 "" 0 0 0 "">
<1140 530 1140 640 "" 0 0 0 "">
<990 530 1140 530 "" 0 0 0 "">
<1140 700 1140 780 "" 0 0 0 "">
<990 780 1140 780 "" 0 0 0 "">
<1020 420 1080 420 "Output" 1050 380 20 "">
<1150 100 1260 100 "" 0 0 0 "">
<1260 100 1260 150 "" 0 0 0 "">
<1140 780 1250 780 "" 0 0 0 "">
<1020 100 1150 100 "" 0 0 0 "">
<660 420 660 450 "" 0 0 0 "">
<640 450 660 450 "" 0 0 0 "">
<640 350 640 360 "" 0 0 0 "">
<640 450 640 500 "" 0 0 0 "">
<640 420 640 450 "" 0 0 0 "">
<580 450 580 480 "" 0 0 0 "">
<580 410 580 450 "" 0 0 0 "">
<440 570 580 570 "" 0 0 0 "">
<580 540 580 570 "" 0 0 0 "">
<480 350 580 350 "" 0 0 0 "">
<480 350 480 690 "" 0 0 0 "">
<480 750 480 780 "" 0 0 0 "">
<520 610 600 610 "" 0 0 0 "">
<520 610 520 650 "" 0 0 0 "">
<360 650 520 650 "" 0 0 0 "">
<240 780 360 780 "" 0 0 0 "">
<760 560 800 560 "" 0 0 0 "">
<760 280 800 280 "" 0 0 0 "">
<250 100 360 100 "" 0 0 0 "">
<710 420 990 420 "" 0 0 0 "">
<800 280 820 280 "" 0 0 0 "">
<800 560 820 560 "" 0 0 0 "">
<580 350 640 350 "" 0 0 0 "">
<800 280 800 350 "" 0 0 0 "">
<800 410 800 560 "" 0 0 0 "">
<760 280 760 320 "" 0 0 0 "">
<760 380 760 440 "" 0 0 0 "">
<580 570 640 570 "" 0 0 0 "">
<640 560 640 570 "" 0 0 0 "">
<580 480 670 480 "" 0 0 0 "">
<740 440 760 440 "" 0 0 0 "">
<670 440 670 480 "" 0 0 0 "">
<670 440 680 440 "" 0 0 0 "">
<1160 420 1160 440 "" 0 0 0 "">
<1140 420 1160 420 "" 0 0 0 "">
<220 420 230 420 "" 0 0 0 "">
<120 420 160 420 "" 0 0 0 "">
<120 420 120 460 "" 0 0 0 "">
<120 420 120 420 "Input" 70 390 0 "">
</Wires>
<Diagrams>
<Rect 620 290 356 167 3 #c0c0c0 1 10 1 0 2e+06 1e+07 1 -0.0930848 0.5 1.09933 1 -1 1 1 315 0 225 1 0 0 "" "" "">
<"ngspice/ac.v(out)" #0000ff 0 3 0 0 0>
<Tab 420 908 450 49 3 #c0c0c0 1 00 1 0 1 1 1 0 1 1 1 0 1 1 315 0 225 1 0 0 "" "" "">
<"ngspice/op1.i(v2)" #0000ff 0 3 1 0 0>
<"ngspice/op1.i(v3)" #0000ff 0 3 1 0 0>
<"ngspice/op1.output" #0000ff 0 3 1 0 0>
</Tab>
<Rect 420 1450 240 160 3 #c0c0c0 1 00 1 0 0.2 1 1 -0.1 0.5 1.1 1 -0.1 0.5 1.1 315 0 225 1 0 0 "" "" "">
<"ngspice/tran1.tran.v(output)" #0000ff 0 3 0 0 0>
</Rect>
<Rect 620 510 363 165 3 #c0c0c0 1 11 1 0 2e+06 1e+07 1 nan 0.5 1.09933 1 -1 1 1 315 0 225 1 1 0 "" "" "">
<"ngspice/ac1.ac.k" #0000ff 0 3 0 0 0>
<Rect 420 1220 240 160 3 #c0c0c0 1 10 1 0 200000 1e+06 1 -3.49625 10 15.3803 1 -1 1 1 315 0 225 1 0 0 "" "" "">
<"ngspice/ac1.ac.v(output)" #0000ff 0 3 0 0 0>
</Rect>
<Tab 620 640 365 57 3 #c0c0c0 1 00 1 0 1 1 1 0 1 1 1 0 1 1 315 0 225 1 0 0 "" "" "">
<"ngspice/ac1.vout_max" #0000ff 0 3 1 0 0>
<"ngspice/ac1.kdb_max" #0000ff 0 3 1 0 0>
<Rect 1000 1220 240 160 3 #c0c0c0 1 00 1 0 0.2 1 1 -0.1 0.5 1.1 1 -0.1 0.5 1.1 315 0 225 1 0 0 "" "" "">
<"ngspice/ac2.ac.v(output)" #0000ff 0 3 0 0 0>
</Rect>
<Rect 1000 1440 240 160 3 #c0c0c0 1 00 1 0 0.2 1 1 -0.1 0.5 1.1 1 -0.1 0.5 1.1 315 0 225 1 0 0 "" "" "">
<"ngspice/tran2.tran.v(output)" #0000ff 0 3 0 0 0>
</Rect>
<Rect 420 1660 240 160 3 #c0c0c0 1 00 1 0 0.2 1 1 -0.1 0.5 1.1 1 -0.1 0.5 1.1 315 0 225 1 0 0 "" "" "">
<"ngspice/four1.ac.v(output)" #0000ff 0 3 0 0 0>
</Rect>
<Rect 1000 1660 240 160 3 #c0c0c0 1 00 1 0 0.2 1 1 -0.1 0.5 1.1 1 -0.1 0.5 1.1 315 0 225 1 0 0 "" "" "">
<"ngspice/four2.ac.v(output)" #0000ff 0 3 0 0 0>
</Rect>
<Rect 600 1907 638 167 3 #c0c0c0 1 10 1 1 1 1e+06 1 -7.75267e-08 2e-07 4.28083e-07 1 -1 1 1 315 0 225 1 0 0 "" "" "">
<"ngspice/noise1.ac.onoise_spectrum" #0000ff 0 3 0 0 0>
<"ngspice/noise1.ac.inoise_spectrum" #ff0000 0 3 0 0 1>
</Rect>
<Rect 420 2140 240 160 3 #c0c0c0 1 10 1 0 20000 100000 1 -0.775035 5 10 1 -16.9264 100 200 315 0 225 1 0 0 "" "" "">
<"ngspice/disto1.ac.v(h2)" #0000ff 0 3 0 0 0>
<"ngspice/disto1.ac.v(h3)" #ff0000 0 3 0 0 1>
</Rect>
<Rect 1000 2140 240 160 3 #c0c0c0 1 00 1 0 0.2 1 1 -0.1 0.5 1.1 1 -0.1 0.5 1.1 315 0 225 1 0 0 "" "" "">
<"ngspice/disto2.ac.v(h2)" #0000ff 0 3 0 0 0>
<"ngspice/disto2.ac.v(h3)" #ff0000 0 3 0 0 1>
</Rect>
<Rect 420 2380 240 160 3 #c0c0c0 1 00 1 0 0.2 1 1 -0.1 0.5 1.1 1 -0.1 0.5 1.1 315 0 225 1 0 0 "" "" "">
<"ngspice/thd1.thd_v" #0000ff 0 3 0 0 0>
</Rect>
<Tab 760 2339 295 119 3 #c0c0c0 1 00 1 0 1 1 1 0 1 1 1 0 1 1 315 0 225 1 0 0 "" "" "">
<"ngspice/thd1.thd_v" #0000ff 0 3 1 0 0>
</Tab>
</Diagrams>
<Paintings>