LTSpice FFT simulation settings and inconsistent results. - diyAudio
Go Back   Home > Forums > Design & Build > Software Tools

Software Tools SPICE, PCB CAD, speaker design and measurement software, calculators

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
Reply
 
Thread Tools Search this Thread
Old 25th February 2012, 07:08 PM   #1
Mooly is offline Mooly  United Kingdom
diyAudio Moderator
 
Mooly's Avatar
 
Join Date: Sep 2007
Default LTSpice FFT simulation settings and inconsistent results.

How do you go about setting up the FFT settings when wanting to do a distortion test ? I am a total newbie to all of this.

Really trying to understand this and how all this would translate into testing a real design (an amp say). Until I can figure this out and make some sense of it all it seems all the results are wide open to interpretation and the actual settings used.


So the starting point is the circuit shown, which is about the simplest possible. An AC voltage source with two series connected 1k resistors across it. The junction of the resistors is Vout.

The settings I have used are shown. The transient analysis is set to run for 10ms. The frequency is 1Khz over 10 cycles.

The FFT result is shown.


I then alter the run time to 100ms and the number of cycles to 100. I set the FFT run to "look at" 0 to 10ms (the same period as in the first run).

The FFT result is now totally different. Why ?

Also what are the peaks beginining at 100Khz. When expanded the first is a double peak of approx 101.4 Khz and 103.4Khz. What causes these ?

The second run with the 100ms run time has a "first" harmonic peak at 3Khz.

Also why is the baseline (noisefloor ??) different ?
Attached Images
File Type: gif FFT Test Circuit.GIF (33.7 KB, 424 views)
File Type: gif FFT Transient Settings.GIF (16.9 KB, 408 views)
File Type: gif FFT Voltage Source Settings.GIF (29.7 KB, 398 views)
File Type: gif FFT Settings.GIF (27.8 KB, 395 views)
File Type: gif FFT Spectrum Result.GIF (22.7 KB, 396 views)
File Type: gif FFT Second Run.GIF (24.4 KB, 155 views)
__________________
-------------------------------------------------------
Installing and using LTspice. From beginner to advanced.
  Reply With Quote
Old 26th February 2012, 02:02 PM   #2
bill_a is offline bill_a  United States
diyAudio Member
 
Join Date: Aug 2009
Location: Seattle
Mooly,
Try setting a minimum time step - it should be at least 1/100 of a cycle. Granted, it takes longer, but the results are closer to what you expect.

Bill
  Reply With Quote
Old 26th February 2012, 02:07 PM   #3
bill_a is offline bill_a  United States
diyAudio Member
 
Join Date: Aug 2009
Location: Seattle
On second thought, use the smallest time step you have the patience for. I just re-ran your test with a 10nS step, and it's very clean.
  Reply With Quote
Old 26th February 2012, 02:36 PM   #4
gootee is offline gootee  United States
diyAudio Member
 
Join Date: Nov 2006
Location: Indiana
Blog Entries: 1
You do need to make sure that you use exactly an integral number of cycles. And you need to keep reducing the minimum timestep until the results stop changing.

I always used the LAST ten (or whatever) cycles of a run, and increased the run time until the results stopped changing (so that the transient response was over and it was fully into steady-state-only behavior).

It will help if you use a variable ("param" statement) to set the frequency and then form expressions to set the number of cycles and run time (or something like that; don't have my spice setup at hand, and it's been quite a while since I've played with this stuff).

As a side note, when using a real spectrum analyser to analyze harmonic distortion, one is confronted with the problem of the mixer that is just after the input attenuator. Mixers, by their nature, produce harmonics. So how would one know if they were measuring harmonics from the input or from both the input and the mixer? The answer, there, is to increase the attenuation of the input signal (either internally or externally) until the results stop changing, because mixers won't produce harmonics if their input levels are low-enough. This applies even for modern spectrum analyzers, which implement everything in digital or software form. This might occasionally apply even in simulations, depending on what is being simulated.

Last edited by gootee; 26th February 2012 at 02:43 PM.
  Reply With Quote
Old 26th February 2012, 05:59 PM   #5
jcx is offline jcx  United States
diyAudio Member
 
Join Date: Feb 2003
Location: ..
small t_max_step in .TRAN - small enough to give >2x # points vs fft length - 256k is my typical Ltspice FFT setting
the t_max_step should give a "sample rate" at least several times the slowest device ft just for minimal realistic stability/step response

integer # of cyclces of the fundamental in the analysis - I usually use integer kHz frequencies, multiples of 1 ms analysis times

use a window - select in the FFT pop up box - Blackman gives very low skirts, requires 4x longer record to resolve between peaks
  Reply With Quote
Old 26th February 2012, 06:23 PM   #6
Mooly is offline Mooly  United Kingdom
diyAudio Moderator
 
Mooly's Avatar
 
Join Date: Sep 2007
bill_a and gootee,

thanks for the directions... it's starting to make a bit more sense now. I tried your 10ns suggestion and can see how much cleaner it is. Hadn't really appreciated the significance of that.

jcx,
up to now I hadn't explored the different windows. tbh I haven't even heard of most of those options before. I'd seen "Blackman" mentioned (must have been on some thread) but I didn't know what it referred too.
Can see the logic in keeping the numbers simple and in easy multiples.

Thanks folks...

I have another question too which I'll post as a new thread if I don't find an answer.
__________________
-------------------------------------------------------
Installing and using LTspice. From beginner to advanced.
  Reply With Quote
Old 1st March 2012, 01:57 AM   #7
diyAudio Member
 
Join Date: Dec 2006
Location: Where the sky loves the sea
Lots of good information here, thanks mainly to keantoken: Common Issues Encountered By New Users - diyAudio

Also see Bob Cordell's book, he goes into some detail on this same subject.
__________________
"We monitor many frequencies. We listen always. Came a voice, out of the babel of tongues, speaking to us. It played us a mighty dub… "
  Reply With Quote
Old 1st March 2012, 06:34 AM   #8
Mooly is offline Mooly  United Kingdom
diyAudio Moderator
 
Mooly's Avatar
 
Join Date: Sep 2007
Thanks mightydub. It's actually Bobs book that got me started on all this in the first place. I'll have a read at the Wiki.
__________________
-------------------------------------------------------
Installing and using LTspice. From beginner to advanced.
  Reply With Quote
Old 1st March 2012, 11:52 AM   #9
RJM1 is offline RJM1  United States
diyAudio Member
 
Join Date: Jan 2010
Location: Titusville, Fl.
I don't know if you've seen these yet.

LTspice getting started guide from Linear.com
http://ltspice.linear.com/software/L...artedGuide.pdf

Yahoo groups LTspice.
LTspice : LTspice/SwitcherCAD III

Last edited by RJM1; 1st March 2012 at 11:55 AM.
  Reply With Quote
Old 1st March 2012, 03:53 PM   #10
cbdb is offline cbdb  Canada
diyAudio Member
 
Join Date: Oct 2008
Location: Vancouver
Mooly, your going to have to change your signature.
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Distortion simulation with LTspice tiagor Solid State 32 22nd December 2012 09:33 PM
Help needed in running LTSPice FFT simulation on the M1 Lateral FET amp Mooly Solid State 11 24th February 2012 06:44 PM
Latest LTspice giving crazy FFT results ray_moth Tubes / Valves 5 6th May 2010 07:07 AM
About LTSpice Simulation. nicholas1113 Solid State 2 15th November 2009 07:52 AM
How to make sense of LTSpice FFT analysis? ray_moth Tubes / Valves 11 12th August 2008 07:43 PM


New To Site? Need Help?

All times are GMT. The time now is 10:07 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright ©1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2