
Home  Forums  Rules  Articles  The diyAudio Store  Gallery  Blogs  Register  Donations  FAQ  Calendar  Search  Today's Posts  Mark Forums Read  Search 
Tubes / Valves All about our sweet vacuum tubes :) Threads about Musical Instrument Amps of all kinds should be in the Instruments & Amps forum 

Please consider donating to help us continue to serve you.
Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving 

Thread Tools  Search this Thread 
19th July 2007, 05:48 AM  #1 
diyAudio Moderator Emeritus
Join Date: Jan 2004
Location: Jakarta

How to make sense of LTSpice FFT analysis?
I've been using LTSpice for a couple of years now, and recently started playing around with the FFT analysis. I confess to being rather confused with the results I'm getting. Perhaps I should say at this point that I don't consider a Spice analysis to be a substitute for the real thing. I realize that a simulation is only as good as the tube models used, that simulation doesn't reflect real world variances between nominally identical devices and that, in consequence, an FFT cannot predict exactly what the end product will sound like, if it ever gets built.
The LTSpice FFT function requires me to select the number of points used in the analysis, so I've started experimenting with this, to see its effect. I've found that the more points included in the FFT analysis , the smoother the graph becomes, the lower the harmonic distortion and the fewer harmonics are present. At one extreme (low number of points analyzed e.g. 13), I get significant harmonic distortion, including 3rd, 5th, 7th, 9th and 11th harmonics. At the other extreme (large number of points analyzed e.g. 61) I get virtually no distortion, with only 3rd and a tiny bit of 5th. I have no idea which of these results is more correct or if the 'truth' lies somewhere in between. This is a PP amp, so there is no evenorder harmonic distortion. Like many aspects of LTSpice, the FFT analysis is not explained in 'help', so there is no guidance on how to get the most meaningful result. Also, I can't find anything relevant at the Yahoo Groups LTSpice users' forum, so I thought I should ask for advice here: does anyone know what would be a sensible number of points to include? 
20th July 2007, 02:08 AM  #2 
diyAudio Member
Join Date: Dec 2001
Location: Hickory, NC

I'm haven't used the FFT in LTSpice yet, but one thing that likely is required is to start and end the data set on the same similar phase point of the test sinewave accurately. (More accurately, the next data point, following your last data point, should be the same as your 1st data point, for a repetitive sinewave signal.) The FFT math assumes the data set repeats endlessly, so any misalignment here will cause weird artifacts in the spectrum.
The sampling theorem would indicate a minimum of 2 data points to capture the fundamental test harmonic and N times as many points to get the Nth harmonic. Practically speaking, I would use more like 8 times that many points or more. Many FFT algorithms also require 2 to some M power points for efficient calculation, so often one will see something like 1024 or 4096 data points used. This in turn can lead one to use a 1.024 KHz test signal, so it comes out accurately repeating in say 1024, 1 usec. spaced, data points. Good luck, Don
__________________
I want a HuvrBoard!! 
20th July 2007, 02:53 AM  #3 
diyAudio Member
Join Date: Dec 2001
Location: Hickory, NC

Oops, make that last line read:
This in turn can lead one to use a 1/(1.024) KHz test signal, so it comes out accurately repeating in say 1024, 1 usec. spaced, data points.
__________________
I want a HuvrBoard!! 
20th July 2007, 03:10 AM  #4 
diyAudio Member
Join Date: Feb 2003
Location: ..

remember to add:
.option plotwinsize=0 to turn off data compression lots of points, both fine time step in .tran and fft points are good ideas, I default at 131K points, Blackman window  always needs 4X the fundamental period analysis time but minimizes spectal splatter many pointers throughout my posts, search user: jcx keywords: fft ltspice show posts 
20th July 2007, 03:43 AM  #5 
diyAudio Member
Join Date: Dec 2001
Location: Hickory, NC

"I default at 131K points, Blackman window  always needs 4X the fundamental period analysis time but minimizes spectal splatter"
Ah, so LTSpice has FFT windowing functions available. This eliminates the need for a binary number of data points and long steady state settling time, but requires 4 times as many data points. The data are windowed, time wise, by a Gaussian or similar ramp up  ramp down type function. So that imperfect matching of the beginning data with the ending data (maybe some DC transient still occuring in the data say) is minimized. Requires lots of processing power though, so helps to have a 1 GHz or faster CPU. Don
__________________
I want a HuvrBoard!! 
20th July 2007, 05:06 PM  #6 
diyAudio Member
Join Date: Feb 2003
Location: ..

still use analysis time = integer # cycles, but yes the window does suppress problems from long RC baseline changes

21st July 2007, 06:38 PM  #7 
diyAudio Member
Join Date: Jun 2004
Location: big smoke

Hi Ray. Here are a couple more suggestions to help generate clean FFT plots. Turning off data compression has already been mentioned. It's crucial, as is ensuring the simulation time (or the selected time window for FFT) capture a waveform starting and ending at zero crossings.
In the FFT menu is a parameter window labeled "Number of data point samples in time". I usually set it to 65536. In the schematic half under "Edit Simulation Command" > Transient, set Timeslice to the reciprocal of the number of data point samples selected for FFT, in this case 1/65536 or 0.0000152587890625. I'm not familiar with the relative benefits of different windowing functions but have been told by pros in the field that Blackman is the way to go so typically leave it at that. One caveat. LTSpice appears to have an oddity regarding data caching. Sometimes making these changes midsession results in unusual FFT plots, for example large spikes above 100 kHz. Closing and restarting the session always clears it. As a sanity check I set the signal source as ideal  no output impedance or parasitics  and run an FFT on it to insure it's 'perfect'. When correct it looks like graph below.
__________________
Ears aren't microphones. 
21st July 2007, 06:41 PM  #8 
diyAudio Member
Join Date: Jun 2004
Location: big smoke

The resultant circuit sims, in this case the modified final stage of a Scott LT110B tuner, are much easier to read as well.
__________________
Ears aren't microphones. 
21st July 2007, 09:00 PM  #9 
diyAudio Moderator Emeritus
Join Date: Jan 2004
Location: Jakarta

Thanks for the helpful suggestions. I've never tried the Blackman window, but I will.
What I have been trying is to run the transient analysis for 30 seconds, with an input signal of 1kHz starting after a delay varying from 29.6 to 29.8 seconds. I then zoom in to show the output trace only for the period that the signal is on. I run the FFT analysis for the same period as the signal ('Use current zoom extent'). There is a big difference in results depending on the signal delay. I've also tried using different values (number of points) for the binomial smoothing and found that I get cleanerlooking results if I make this number much bigger than the default of 5 (around 45 or more). 
22nd July 2007, 02:40 AM  #10 
diyAudio Member
Join Date: Jun 2004
Location: big smoke

Thirty seconds? I envy anyone with a personal Cray.
Long runs before data capture begins allow 'the circuit' to stabilize. Not all require it. The graphs posted earlier  a simple LED biased, choke loaded, Rcoupled two 12at7 circuit  was based on a 200 msec total run, from 0100 msec for warmup and data captured from 100 to 200 msec with a 1000 Hz source. Obviously, that works out to 100 full cycles at 1000 Hz (but only 10 at 100 Hz.) As another sanity check the same sim as above was run under identical conditions except 1 sec was added to both parameters. Capture began at 1100 msec and ended at 1200 msec. In this case 100 msec of warmup is apparently plenty for computational accuracy well exceeding that of the tube model, the distrotion harmonics were unaffected. Long capture periods are great for improving resolution and low frequency accuracy, though it's a judgement call if the additional information is useful. The sim above was altered to capture a full second of data after the same 1100 msec of warm up. The input spectrum is shown below.
__________________
Ears aren't microphones. 
Thread Tools  Search this Thread 


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Does USB>I2S make sense ?  percy  Digital Line Level  20  24th March 2009 02:23 AM 
Linear voltage regulator: how to make good use of "sense" and "ground sense"?  NeoY2k  Analog Line Level  7  7th September 2008 12:35 AM 
TL, does this now make sense?  Madmike2  MultiWay  2  8th May 2005 03:39 PM 
does this make sense?  nosegoblin  Solid State  9  14th February 2004 03:19 PM 
Does this make sense?  Illusus  Chip Amps  11  25th September 2003 02:59 PM 
New To Site?  Need Help? 