# Fourier transform - LTSpice

Is it possible to get the Fourier transform in LTSpice? For example I'd like to plot the Fourier transform of the following signal:

$$s(t)=A \space sin(2\pi f_0t)$$ Can you attached a LTSpice example file please?

Thank you for your time.

• Right click on the waveform window and choose View>FFT. It is assumd you know what you're doing and know how to set up your signal period & co. Also, you wil only see the shifted (to the right) version, but that shouldn't matter too much. Jul 8, 2017 at 5:59
• Hi @aconcerncitizen, I did it, but the result is an horrible wave. Jul 8, 2017 at 10:59
• Consider this example: i.stack.imgur.com/bRGjg.png . If the periods don't match, you'll get garbage, or you'll have to use a window of some sorts, here Kaiser (beta=7). Jul 9, 2017 at 6:26
• I'm not sure what goes wrong for you. Simply choosing View>FFT, no other settings, reveals a bin of ~10.97dB@1Hz, with rather high noise floor and minor harmonics (because LTspice, by default, uses waveform compression). If you impose a tighter timestep (say 1ms, or so), you'll get better noise floor, and if you also add .opt plotwinsize=0 it will disable waveform compression and you'll get hundreds of dB noise floor. If you're expecting to see a textbook picture, you won't. LTspice shows what a spectrum analyser would show (or similar). Jul 9, 2017 at 16:50
• Just a thought: if you right-click the Y axis and choose linear, you'll get a clearer picture. Jul 9, 2017 at 16:51

This is beyond the capablities of circuit simulators. The simulators handle only finite length signal bursts. You will not get the same spectrum, because the signal in your example is the theoretical sinewave which has never started and will never stop. It has existed unchanged from t = -eternity and will go on to t = +eternity. It has infinite energy, so it occurs as Dirac's impulses in the Fourier transform.

Simulators calculate the discrete fourier transform. It's said FFT due the used high-speed calculation algorithm. It shows the signal as it were combined from sinewaves which have frequencies 0, 1/T, 2/T, 3/T...Fsample/2 where T is the simulation period and Fsample is the used sample rate.

If your sample rate in the simulation happens to be an integral part of the cycle length of the sinewave and the simulation time period happens to be an integral multiple of the cycle length and no automatic smooth windowing spoils the start and end, then you get something that resembles your theoretical spectrum. It will not be strictly 2 spikes. The numeric rounding errors occur as a noise floor (=extra frequency components) in the spectrum. The energy of the spectrum only will be not infite, but the total energy of the sinewave in the simulation period.

Unfortunately I have not LTspice and do not know, how to order the right Fourier transform mode (=rectangular windowing, show positive and negative frequencies and the phase angles).

I've never tried it myself, but from the LTspice Help.

.FOUR -- Compute a Fourier Component after a .TRAN Analysis Syntax: .four [Nharmonics] [Nperiods] [ ...]

Example: .four 1kHz V(out)

This command is performed after a transient analysis. It's supplied in order to be compatible with legacy SPICE simulators. The output from this command is printed in the .log file. Use the menu item "View=>Spice Error Log" to see the output. For most purposes, the FFT capability built into the waveform viewer is more useful.

If the integer Nharmonics is present, then the analysis includes that number of harmonics. The number of harmonics defaults to 9 if not specified.

The Fourier analysis is performed over the period from the final time, Tend, to one period before Tend unless an integer Nperiods is given after Nharmonics. If Nperiods is given as -1, the Fourier analysis is performed over the entire simulation data range.

• OP wants to see a visual representation, not a table of characters. Apr 10, 2018 at 14:41

The thing is that LTspice simulate, thus it can not output the real analytic Fourier transform. But you can get a close approximation of it by looking at the FFT output of an ideal source. Also the resulting graph shows only the real half of the Fourier transform

As you can see below for the sine function: $$s(t)= 1 \cdot sin(2\pi \cdot 1\cdot10^3 \cdot t)$$ Which has the net name sine_out on my simulation. 