Is it possible to alternate between a 0 and 180° shift at regular intervals (say every second) for a sine source in a circuit during a .tran operation in LTspice? (I need to see the reaction of my circuit to a phase shift)
I am using LTspice XVII
Is it possible to alternate between a 0 and 180° shift at regular intervals (say every second) for a sine source in a circuit during a .tran operation in LTspice? (I need to see the reaction of my circuit to a phase shift)
I am using LTspice XVII
The LTspice examples below gives three different techniques.
Circuit A has repeated transitions ad infinitum. It works fine for lower frequencies, perhaps < 1 MHz. Using a faster rise time <= 1 ns for the pulse generator will be better behaved at frequencies above 1 MHz.
Circuit B has only two transitions, but is better behaved at the transition. It will work for frequencies above 1 MHz as well as lower frequencies.
Another option is using an arbitrary piece-wise linear voltage source (PWL option for a voltage source) where you supply a numeric file for the signal.
Adjust the parameters for your case. The example uses a 1 MHz sine wave to see transition issues.
[Edit]
I like Voltage Spike's idea of using a B source due to simplicity (give him the credit if you like this solution).
Example below. You need to mind the rise time of the pulse generator so the phase transition doesn't get damaged. I put in a rise & fall time of \$ 1 \over {frequency \times 1000}\$ which seems to work well.
One method you could use is a bsource with a function that multiplies the sine wave by -1 or 1 and that signal could be generated by a PWL source.