How to implement frequency sweep in transient mode in LTspice?

If you want this in transient analysis, basically doing a chirp I guess, then use a behavioral voltage source. They can slow down LTspice's analysis, but they work fine.

These are found in the F2 selection box as BV. Use one of those. Right-click on the F=V() formula that it presents and stuff in an equation you like. A linear chirp will be something like \$2\pi\cdot \left(f+k\cdot time\right)\cdot time\$, but you can pick whatever you want. \$time\$ is a variable that LTspice understands. So you can use that name, exactly. The value for \$f\$ and for \$k\$ are something you'll have to enter in, or else use a .PARAM deck card for those.

One problem will be LTspice's selection for its maximum timestep. In the .TRAN card, make sure you set that small enough to get good data on the highest frequency. Don't trust LTspice to automatically work out the best value. Use your own judgment there and select a definite value.

Here's an example I just produced, using \$f=1\:\textrm{Hz}\$ and \$k=0.5\$:

enter image description here


The suggestion by a-concerned-citizen is actually pretty easy to set up. First off, just go to LTspice's help and do a search for modulate and then select the "Special Functions" offering. There is a short discussion there, plus a reference to an example circuit that can be loaded and examined.

Here's a capture of LTspice where I added one of these and set it up to go from \$1\:\textrm{Hz}\$ to \$100\:\textrm{Hz}\$:

enter image description here

I took the trouble to also show the LTspice dialog box where I inserted the mark and space values, as well.


For a more generic frequency sweep, try this. Add a BV (behavioral voltage) source with equation: V=sin(6.283*(Fs+(Fe-Fs)/te*time/2)*time)

note that θ = 6.283*(Fs+(Fe-Fs)*time/(te*2))*time

frequency is dθ/dt

f = dθ/dt = 6.283(Fs + (Fe-Fs)*2*time/(te*2))

f = dθ/dt = 6.283(Fs + (Fe-Fs)*time/te)

note: extra 2 in the denominator added b/c d/dt(time^2)=2*time

Fs = Frequency start

Fe = Frequency end

te = time end = how long to simulate

.param Fs 0

.param Fe 32000

.param te 10m

.tran 0 {te} 0

Below example shows sweeping the frequency from 0 to 32kHz. At about 16kHz the circuit is resonant.

enter image description here

Tags:

Ltspice