* Z:\home\khalils\Downloads\files\data\raw_asc\152eb8d82437_Stepped_Sine1.asc
* Generated by LTspice 26.0.1 for Windows.
B1 f 0 V=if(time>kd,limit(k1,V(fh2)*fmul,1),k1)
A1 f 0 0 0 0 C S 0 MODULATOR space=0 mark={f2} Vhigh={Amp} Vlow={-Amp}
A2 SQ 0 0 0 0 0 sd 0 counter cycles={cycles}
A4 f 0 sd 0 0 0 fh 0 SAMPLEHOLD
A6 fh 0 SQ 0 0 0 fh2 0 SAMPLEHOLD
A5 0 S N001 0 0 0 SQ 0 AND ref=0
V1 N001 0 PULSE(-1 1 {kd} 1n 1n)
* .tran 0 {To} {kd*0}
.param f1=20 f2=20k To=(cycles*2.4115/f1)+kd
.param k1=f1/f2
.param kd=(cycles+0)/f1 ;can be changed
.param cycles=30
* Attempt for a time-optimal stepped frequency source for Swept Sine THD meter.
.param fmul=sqrt(2)
* Are there ideas for simpler realization?
* Frequ. is stepped at a factor of fmul : F(n+1)/F(n) = fmul\nStep duration for the 1st step is determined by param kd,\nfollowing steps have duration = cycles/actual_frequency
* If fmul is changed\nTo must be readjusted!\n( nonlinear relation\nTs(fmul) )
.param Amp=1
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 1680 680
WIRE 576 128 576 96
WIRE 576 128 144 128
WIRE 912 128 576 128
WIRE 1120 176 1088 176
WIRE 144 192 144 128
WIRE 288 192 144 192
WIRE 448 192 432 192
WIRE 480 192 480 96
WIRE 480 192 448 192
WIRE 560 192 480 192
WIRE 688 192 688 96
WIRE 688 192 624 192
WIRE 720 192 688 192
WIRE 832 192 832 96
WIRE 832 192 784 192
WIRE 912 192 832 192
WIRE 560 208 528 208
WIRE 144 256 144 192
WIRE 464 256 432 256
WIRE 528 288 528 208
WIRE 1120 480 1120 176
WIRE 1120 480 656 480
WIRE 272 528 272 448
WIRE 480 528 272 528
WIRE 688 544 688 192
WIRE 688 544 656 544
FLAG 576 96 f
IOPIN 576 96 Out
FLAG 144 336 0
FLAG 448 192 S
FLAG 1120 176 fh
FLAG 832 96 sd
IOPIN 832 96 Out
FLAG 272 448 fh2
FLAG 480 96 S
IOPIN 480 96 Out
FLAG 688 96 SQ
IOPIN 688 96 Out
FLAG 528 368 0
FLAG 464 256 C
SYMBOL bv 144 240 R0
WINDOW 3 -133 136 Left 0
WINDOW 0 -32 8 Left 0
WINDOW 123 -32 36 Left 0
SYMATTR Value V=if(time>kd,limit(k1,V(fh2)*fmul,1),k1)
SYMATTR InstName B1
SYMBOL SpecialFunctions\\modulate2 288 192 R0
WINDOW 3 0 112 Left 0
WINDOW 123 0 130 Left 0
WINDOW 39 0 148 Left 0
WINDOW 0 0 -46 Left 0
SYMATTR Value space=0 mark={f2}
SYMATTR Value2 Vhigh={Amp}
SYMATTR SpiceLine Vlow={-Amp}
SYMATTR InstName A1
SYMBOL Digital\\buf1 720 128 R0
WINDOW 3 -12 117 Left 0
SYMATTR Value cycles={cycles}
SYMATTR InstName A2
SYMATTR SpiceModel counter
SYMBOL SpecialFunctions\\sample 992 160 R0
SYMATTR InstName A4
SYMBOL SpecialFunctions\\sample 576 512 M0
SYMATTR InstName A6
SYMBOL Digital\\and 592 144 R0
WINDOW 3 -18 118 Left 0
SYMATTR Value ref=0
SYMATTR InstName A5
SYMBOL voltage 528 272 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value PULSE(-1 1 {kd} 1n 1n)
TEXT -104 -120 Left 0 ;.tran 0 {To} {kd*0}
TEXT -128 -56 Left 0 !.param f1=20 f2=20k To=(cycles*2.4115/f1)+kd
TEXT -128 -24 Left 0 !.param k1=f1/f2
TEXT -128 16 Left 0 !.param kd=(cycles+0)/f1 ;can be changed
TEXT -128 56 Left 0 !.param cycles=30
TEXT 192 -120 Left 0 ;Attempt for a time-optimal stepped frequency source for Swept Sine THD meter.
TEXT -128 96 Left 0 !.param fmul=sqrt(2)
TEXT 776 560 Left 0 ;Are there ideas for simpler realization?
TEXT 488 -72 Left 0 ;Frequ. is stepped at a factor of fmul : F(n+1)/F(n) = fmul\nStep duration for the 1st step is determined by param kd,\nfollowing steps have duration = cycles/actual_frequency
TEXT -120 128 Left 0 ;If fmul is changed\nTo must be readjusted!\n( nonlinear relation\nTs(fmul)  )
TEXT 280 96 Left 0 !.param Amp=1