FFT in LTSPICE XVII - force settings - Page 1
Forum section: electronics / general

author: fcb
author_rank: Super Contributor
timestamp: May 18, 2020, 09:37:02 am
content: Is there a way to force the setting of the FFT in LTspice (using XVII).I'm already using the.fouroperative to create THD readouts successfully and also the FFT (View>FFT).Problem is that it (FFT) doesn't seem to remember my 'specify a time range/time range' choices and requires resetting every simulation run (although it does remember my choice of window?).?Any ideas if their are some operatives/instructions to force the the FFT?

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 18, 2020, 01:17:26 pm
content: IIRC, the View/FFT computes an FFT over the portion of signal in the current window by default. I don't think there is any other way to make it "remember" the time range. So your best bet, if you want to issue an FFT over a specific time range, would be to define this time range in the transient simulation (time to start saving data/stop time).

author: fcb
author_rank: Super Contributor
timestamp: May 18, 2020, 01:49:49 pm
content: Thanks SiliconWizard.That fix does work and is saving my sometime. Still be nice if their were .op options to force the settings of the FFT, perhaps someone from LT/AD will read this.

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 18, 2020, 01:53:00 pm
content: Quote from: fcb on May 18, 2020, 09:37:02 amCan you share your model? or an example with the same challenges?There may be a solution.Regards,Jay_Diddy_B

author: fcb
author_rank: Super Contributor
timestamp: May 18, 2020, 02:08:25 pm
content: Sorry Jay_Diddy_B. It's under a fairly draconian NDA.For anybody else searching how to do an FFT or THD (.four) using LTspice, this is the main resource I used:

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 18, 2020, 02:20:47 pm
content: Quote from: fcb on May 18, 2020, 01:49:49 pmMaybe.IMO, the FFT view is an integral part of the waveform viewer, and thus follows the same "philosophy". It's meant to be interactive.And then, your need could actually be translated to other parts of the viewer. I find LTSpice's waveform viewer to be lacking in a lot of areas actually - would be nice if it could get a good overhaul. You may take a look at Micro-cap 12 (which has been made free) to get an idea of what a nice waveform viewer could be.

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 18, 2020, 02:32:34 pm
content: Hi FCB,Since you can't share your circuit, I will share mine:If I run this model I get:Which includes the start up behaviour.If use the FFT function, the default is:and the resulting FFT is:If I look at the FFT for the last 10ms, that is from 10ms to 20ms I get>Which doesn't include the start-up.What do you want to do? using my model an example.Regards,Jay_Diddy_Bfft transient.asc(0.62 kB - downloaded 65 times.)

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 18, 2020, 02:54:55 pm
content: Hi,You can also do this:The simulation will run three times. Each time it runs 10ms after the start.The resulting FFTs are:Regards,Jay_Diddy_B

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 18, 2020, 02:59:53 pm
content: Hi,IF I add:.four 1kHz I(R1)to the model, and look at the SPICE error log:Code:Circuit: * D:\projects\eevblog fft 2020\fft transient.ascDirect Newton iteration for .op point succeeded..step start=0N-Period=1Fourier components of I(r1)DC component:-3.14927e-005HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+033.370e-021.000e+00-105.99°0.00°22.000e+031.550e-044.601e-0322.40°128.38°33.000e+032.728e-038.096e-0291.57°197.56°44.000e+035.102e-051.514e-039.58°115.57°55.000e+038.626e-042.560e-0288.42°194.40°66.000e+033.191e-059.470e-045.73°111.72°77.000e+034.242e-041.259e-0286.38°192.37°88.000e+032.342e-056.949e-043.71°109.70°99.000e+032.519e-047.476e-0384.61°190.60°Total Harmonic Distortion: 8.631035%(8.665294%).step start=0.01N-Period=1Fourier components of I(r1)DC component:2.26431e-007HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+033.356e-021.000e+00-105.71°0.00°22.000e+035.077e-051.513e-036.05°111.76°33.000e+032.651e-037.901e-0292.45°198.16°44.000e+031.684e-055.019e-040.20°105.91°55.000e+038.159e-042.431e-0289.68°195.39°66.000e+031.029e-053.066e-04-1.78°103.94°77.000e+033.890e-041.159e-0287.78°193.49°88.000e+037.340e-062.187e-04-3.27°102.44°99.000e+032.256e-046.723e-0386.01°191.72°Total Harmonic Distortion: 8.376411%(8.406611%).step start=0.02N-Period=1Fourier components of I(r1)DC component:-3.13169e-007HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+033.362e-021.000e+00-105.78°0.00°22.000e+034.760e-051.416e-038.29°114.08°33.000e+032.518e-037.489e-0292.26°198.04°44.000e+031.382e-054.112e-042.48°108.26°55.000e+037.324e-042.178e-0289.08°194.87°66.000e+038.120e-062.415e-04-4.98°100.80°77.000e+033.455e-041.028e-0285.86°191.64°88.000e+035.745e-061.709e-04-6.79°99.00°99.000e+032.130e-046.334e-0385.15°190.93°Total Harmonic Distortion: 7.893936%(7.932186%)Date: Mon May 18 10:55:51 2020Total elapsed time: 1.422 seconds.tnom = 27temp = 27method = modified traptotiter = 7807traniter = 7804tranpoints = 3903accept = 3183rejected = 720matrix size = 4fillins = 0Matrix Compiler1: off [0.2]/0.2/0.2Matrix Compiler2: off [0.2]/0.4/0.3I have the THD for the three windows.Does this help?Jay_Diddy_B

author: fcb
author_rank: Super Contributor
timestamp: May 18, 2020, 03:47:37 pm
content: The problem I had was that until circuit settled down (after ~1ms) the FFT would show LF garbage.By reducing the visible data (.tran 0 2ms 1ms 1ns) to between 1ms to 2ms I solve the problem with the FFT settings not 'sticking', but I'm also interested in looking how .raw looks from 0-2ms. It's a minor but irritating thing. Traces below:0-2ms1-2ms