* SPICE netlist
V1 VctrA 0 SINE({Vtri/2} {Vctr} {f1} 0 0 0)
V2 VctrB 0 SINE({Vtri/2} {Vctr} {f1} 0 0 120)
V3 VctrC 0 SINE({Vtri/2} {Vctr} {f1} 0 0 -120)
B1 N002 0 V=if(V(VctrA)>=V(tri),1,0)
E1 N003 N008 N002 0 1
S1 A N001 N003 N008 SW
B2 N011 0 V=if(V(VctrA)<V(tri),1,0)
E2 N012 N017 N011 0 1
S2 0 A N012 N017 SW
B3 N004 0 V=if(V(VctrB)>=V(tri),1,0)
E3 N005 N009 N004 0 1
S3 B N001 N005 N009 SW
B4 N013 0 V=if(V(VctrB)<V(tri),1,0)
E4 N014 N018 N013 0 1
S4 0 B N014 N018 SW
B5 N006 0 V=if(V(VctrC)>=V(tri),1,0)
E5 N007 N010 N006 0 1
S5 C N001 N007 N010 SW
B6 N015 0 V=if(V(VctrC)<V(tri),1,0)
E6 N016 N019 N015 0 1
S6 0 C N016 N019 SW
V4 N001 0 314
V5 N021 N022 SINE(0 75 {f1} 0 0 0)
R1 N020 A 2
L1 N021 N020 10m
V6 N024 N022 SINE(0 75 {f1} 0 0 120)
R2 N023 B 2
L2 N024 N023 10m
V7 N026 N022 SINE(0 75 {f1} 0 0 -120)
R3 N025 C 2
L3 N026 N025 10m
V8 tri 0 PULSE(0 {Vtri} 0 {1/(2*Fs)} {1/(2*Fs)} 0 {1/Fs})
.param f1=50
.param Fs=1k
.param Vtri=1
.param ma=0.95
.param Vctr=0.5*ma*Vtri
.tran 0 100m 41m
.four {f1} I(L1)

* LTspice schematic (.asc)
Version 4
SHEET 1 2016 784
WIRE -64 -392 -608 -392
WIRE 416 -392 -64 -392
WIRE 896 -392 416 -392
WIRE -608 -344 -608 -392
WIRE -976 -296 -992 -296
WIRE -272 -296 -400 -296
WIRE -112 -296 -224 -296
WIRE 208 -296 80 -296
WIRE 368 -296 256 -296
WIRE 688 -296 560 -296
WIRE 848 -296 736 -296
WIRE -992 -264 -992 -296
WIRE -400 -264 -400 -296
WIRE -224 -264 -224 -296
WIRE -64 -264 -64 -392
WIRE 80 -264 80 -296
WIRE 256 -264 256 -296
WIRE 416 -264 416 -392
WIRE 560 -264 560 -296
WIRE 736 -264 736 -296
WIRE 896 -264 896 -392
WIRE -608 -248 -608 -264
WIRE -272 -248 -272 -296
WIRE -112 -248 -112 -296
WIRE 208 -248 208 -296
WIRE 368 -248 368 -296
WIRE 688 -248 688 -296
WIRE 848 -248 848 -296
WIRE -400 -168 -400 -184
WIRE -272 -168 -272 -200
WIRE -272 -168 -400 -168
WIRE 80 -168 80 -184
WIRE 208 -168 208 -200
WIRE 208 -168 80 -168
WIRE 560 -168 560 -184
WIRE 688 -168 688 -200
WIRE 688 -168 560 -168
WIRE -976 -152 -992 -152
WIRE -400 -152 -400 -168
WIRE -224 -152 -224 -184
WIRE -112 -152 -112 -200
WIRE -112 -152 -224 -152
WIRE 80 -152 80 -168
WIRE 256 -152 256 -184
WIRE 368 -152 368 -200
WIRE 368 -152 256 -152
WIRE 560 -152 560 -168
WIRE 736 -152 736 -184
WIRE 848 -152 848 -200
WIRE 848 -152 736 -152
WIRE -992 -120 -992 -152
WIRE -64 -104 -64 -184
WIRE -32 -104 -64 -104
WIRE 416 -104 416 -184
WIRE 448 -104 416 -104
WIRE 896 -104 896 -184
WIRE 1008 -104 896 -104
WIRE -272 -40 -400 -40
WIRE -112 -40 -224 -40
WIRE 208 -40 80 -40
WIRE 368 -40 256 -40
WIRE 688 -40 560 -40
WIRE 848 -40 736 -40
WIRE -992 -8 -1008 -8
WIRE -400 -8 -400 -40
WIRE -224 -8 -224 -40
WIRE -64 -8 -64 -104
WIRE 80 -8 80 -40
WIRE 256 -8 256 -40
WIRE 416 -8 416 -104
WIRE 560 -8 560 -40
WIRE 736 -8 736 -40
WIRE 896 -8 896 -104
WIRE -272 8 -272 -40
WIRE -112 8 -112 -40
WIRE 208 8 208 -40
WIRE 368 8 368 -40
WIRE 688 8 688 -40
WIRE 848 8 848 -40
WIRE -1008 24 -1008 -8
WIRE -400 88 -400 72
WIRE -272 88 -272 56
WIRE -272 88 -400 88
WIRE 80 88 80 72
WIRE 208 88 208 56
WIRE 208 88 80 88
WIRE 560 88 560 72
WIRE 688 88 688 56
WIRE 688 88 560 88
WIRE -400 104 -400 88
WIRE -224 104 -224 72
WIRE -112 104 -112 56
WIRE -112 104 -224 104
WIRE 80 104 80 88
WIRE 256 104 256 72
WIRE 368 104 368 56
WIRE 368 104 256 104
WIRE 560 104 560 88
WIRE 736 104 736 72
WIRE 848 104 848 56
WIRE 848 104 736 104
WIRE -64 200 -64 72
WIRE 416 200 416 72
WIRE 896 200 896 72
WIRE -368 232 -416 232
WIRE -240 232 -288 232
WIRE 32 232 -160 232
WIRE 208 232 112 232
WIRE 368 280 368 248
WIRE -368 312 -416 312
WIRE -240 312 -288 312
WIRE 32 312 -160 312
WIRE 208 312 208 232
WIRE 208 312 112 312
WIRE -352 392 -400 392
WIRE -224 392 -272 392
WIRE 48 392 -144 392
WIRE 208 392 208 312
WIRE 208 392 128 392
WIRE 368 392 368 360
FLAG -976 -296 VctrA
FLAG -992 -184 0
FLAG -976 -152 VctrB
FLAG -992 -40 0
FLAG -992 -8 VctrC
FLAG -1008 104 0
FLAG -400 -152 0
FLAG -400 104 0
FLAG -32 -104 A
FLAG -64 200 0
FLAG 80 -152 0
FLAG 80 104 0
FLAG 448 -104 B
FLAG 416 200 0
FLAG 560 -152 0
FLAG 560 104 0
FLAG 1008 -104 C
FLAG 896 200 0
FLAG -608 -248 0
FLAG -416 232 A
FLAG -416 312 B
FLAG -400 392 C
FLAG 368 392 0
FLAG 368 248 tri
SYMBOL voltage -992 -280 R0
SYMATTR InstName V1
SYMATTR Value SINE({Vtri/2} {Vctr} {f1} 0 0 0)
SYMBOL voltage -992 -136 R0
SYMATTR InstName V2
SYMATTR Value SINE({Vtri/2} {Vctr} {f1} 0 0 120)
SYMBOL voltage -1008 8 R0
SYMATTR InstName V3
SYMATTR Value SINE({Vtri/2} {Vctr} {f1} 0 0 -120)
SYMBOL bv -400 -280 R0
SYMATTR InstName B1
SYMATTR Value V=if(V(VctrA)>=V(tri),1,0)
SYMBOL e -224 -280 R0
SYMATTR InstName E1
SYMATTR Value 1
SYMBOL sw -64 -168 M180
SYMATTR InstName S1
SYMBOL bv -400 -24 R0
SYMATTR InstName B2
SYMATTR Value V=if(V(VctrA)<V(tri),1,0)
SYMBOL e -224 -24 R0
SYMATTR InstName E2
SYMATTR Value 1
SYMBOL sw -64 88 M180
SYMATTR InstName S2
SYMBOL bv 80 -280 R0
SYMATTR InstName B3
SYMATTR Value V=if(V(VctrB)>=V(tri),1,0)
SYMBOL e 256 -280 R0
SYMATTR InstName E3
SYMATTR Value 1
SYMBOL sw 416 -168 M180
SYMATTR InstName S3
SYMBOL bv 80 -24 R0
SYMATTR InstName B4
SYMATTR Value V=if(V(VctrB)<V(tri),1,0)
SYMBOL e 256 -24 R0
SYMATTR InstName E4
SYMATTR Value 1
SYMBOL sw 416 88 M180
SYMATTR InstName S4
SYMBOL bv 560 -280 R0
SYMATTR InstName B5
SYMATTR Value V=if(V(VctrC)>=V(tri),1,0)
SYMBOL e 736 -280 R0
SYMATTR InstName E5
SYMATTR Value 1
SYMBOL sw 896 -168 M180
SYMATTR InstName S5
SYMBOL bv 560 -24 R0
SYMATTR InstName B6
SYMATTR Value V=if(V(VctrC)<V(tri),1,0)
SYMBOL e 736 -24 R0
SYMATTR InstName E6
SYMATTR Value 1
SYMBOL sw 896 88 M180
SYMATTR InstName S6
SYMBOL voltage -608 -360 R0
SYMATTR InstName V4
SYMATTR Value 314
SYMBOL voltage 16 232 R270
SYMATTR InstName V5
SYMATTR Value SINE(0 75 {f1} 0 0 0)
SYMBOL res -272 216 R90
SYMATTR InstName R1
SYMATTR Value 2
SYMBOL ind -144 216 R90
SYMATTR InstName L1
SYMATTR Value 10m
SYMBOL voltage 16 312 R270
SYMATTR InstName V6
SYMATTR Value SINE(0 75 {f1} 0 0 120)
SYMBOL res -272 296 R90
SYMATTR InstName R2
SYMATTR Value 2
SYMBOL ind -144 296 R90
SYMATTR InstName L2
SYMATTR Value 10m
SYMBOL voltage 32 392 R270
SYMATTR InstName V7
SYMATTR Value SINE(0 75 {f1} 0 0 -120)
SYMBOL res -256 376 R90
SYMATTR InstName R3
SYMATTR Value 2
SYMBOL ind -128 376 R90
SYMATTR InstName L3
SYMATTR Value 10m
SYMBOL voltage 368 264 R0
SYMATTR InstName V8
SYMATTR Value PULSE(0 {Vtri} 0 {1/(2*Fs)} {1/(2*Fs)} 0 {1/Fs})