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.
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
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.
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.