I can sweep the frequency in time by using modulate, but I couldn't find any example on creating a varying duty cycle or a duty cycle is swept from zero to 100% at a given frequency f in a time interval.
Is there a way/workaround to sweep duty cycle over time in LTspice?
Edit:
I have the following timer circuit which can do that.
But that wasn't I was looking for, since this type of solution slows down the simulation a lot. I was wondering is there a fast way to do that with a single special function or SPICE command.
Please left click on the below plot to enlarge and be able to see the duty cycle variation:
Best Answer
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):
Then we use the actual time and the if function as a cutoff point for creating a square wave with an arbitrary voltage source:
This should give you a good starting point to tinker around and adapt to your needs.