Is there a way to sweep duty cycle over time in LTspice
I am not quite sure if this is what you really want, but lets try anyways. First we create a sawtooth ramp with a certain frequency by using our own defined modulo function with the time (green trace):

.function mod(x,y) { (x/y)-int(x/y) }


Then we use the actual time and the if function as a cutoff point for creating a square wave with an arbitrary voltage source:

V=if( (mod(time*10,1)) &gt; time, 1, 0 )




This should give you a good starting point to tinker around and adapt to your needs.