LTSpice FFT simulation settings and inconsistent results. - Page 2 - 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 1st March 2012, 05:11 PM   #11
Mooly is offline Mooly  United Kingdom
diyAudio Moderator
 
Mooly's Avatar
 
Join Date: Sep 2007
Quote:
Originally Posted by RJM1 View Post
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
The user group looks well worth a look, thanks. Downloaded the pdf too.

Quote:
Originally Posted by cbdb View Post
Mooly, your going to have to change your signature.
Lol, don't I just know it
__________________
-------------------------------------------------------
Installing and using LTspice. From beginner to advanced.
  Reply With Quote
Old 8th March 2012, 10:19 AM   #12
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
Blog Entries: 2
Mooly, here is a zip file with the simulation I use by default for all my amps. It gets very consistent results and a low noise floor.

Spice simulation

For FFT, make sure to use Blackman or Hann windowing, as rectangular window (default) gives a bloated noise floor. Here's some stuff that was recently posted on the topic:

Spice simulation
  Reply With Quote
Old 8th March 2012, 11:48 AM   #13
Mooly is offline Mooly  United Kingdom
diyAudio Moderator
 
Mooly's Avatar
 
Join Date: Sep 2007
Thanks keantoken, I've downloaded your file so will have a study and a play.

I know I've a lot to learn, and there's a lot to read too.

Thanks
__________________
-------------------------------------------------------
Installing and using LTspice. From beginner to advanced.
  Reply With Quote
Old 8th March 2012, 12:43 PM   #14
diyAudio Member
 
jan.didden's Avatar
 
Join Date: May 2002
Location: Great City of Turnhout, Belgium
Blog Entries: 7
Quote:
Originally Posted by keantoken View Post
Mooly, here is a zip file with the simulation I use by default for all my amps. It gets very consistent results and a low noise floor.

Spice simulation

For FFT, make sure to use Blackman or Hann windowing, as rectangular window (default) gives a bloated noise floor. Here's some stuff that was recently posted on the topic:

Spice simulation
I always thought that with a simulator you can use a rectangular or even no window because you can always run the FFT on an exact integer number of signal cycles.

Generally, windows are needed to avoid aliasing when the analysed signal section doesn't nicely start/stop at integer cycles. But, using a window does make the result less accurate.

So, when you use a window in LTspice, does it decrease the accuracy?

jan
__________________
If you don't change your beliefs, your life will be like this forever. Is that good news? - W. S. Maugham
Check out Linear Audio!
  Reply With Quote
Old 8th March 2012, 01:09 PM   #15
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
Blog Entries: 2
I have not experienced a significant change in relative db values unless the noise floor is too high in rectangular window (and this is often for rectangular window). It is not the noise floor itself that is the problem, it is the noise floor tilt. This occurs when the window edges (try "preview window" in the FFT diologue) are non-zero and so a very long signal covers many successive windowed samples, without being fairly attenuated. This signal overwhelms the others and presents itself as a massive "tilt" in the noise floor. This is not the same as the very high noise floor that results when a low number of samples is used and the signal frequency is fractional to the samplerate.

Baudline makes this very clear, the effects of windowing become very obvious when using spectrograms because they largely affect the range and depth of the visual information. The accuracy depends largely on the specific window used. I found in spectrograms I preferred Hann. With spectrograms you can see that the thinner (widthwise) a window, the wider and less distinct the signals are. Hann and blackman I found were the competitors for audio, because of the conservative shapes and zero'd edges. I prefer Hann because the frequency resolution is better, and it seems to generate less artefacts. It is symmetrical, vertically and horizontally, so it seems to me it would be more impartial, and lends itself to using window size and number of samples to manipulate the resolution instead. Maybe I should post some Baudline screenshots as an example?

Synchronizing the frequency and the samplerate like in my simulator directives (and like you and most people suggest) provides the ultimate economy between the necessary number of cycles and samples to get usable data. There are however times when using an irrational fractional signal-to sample ratio is helpful; but I have never needed to study this and it makes it much more difficult to get a detailed simulation in a short amount of time.

Last edited by keantoken; 8th March 2012 at 01:15 PM.
  Reply With Quote
Old 8th March 2012, 01:20 PM   #16
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
Blog Entries: 2
I am double-posting because I made some big edits to my last post, and most people miss them anyways. I just compared Blackman to Hann, and the difference is that Hann has better frequency resolution, but Blackman has a lower noise floor, owing to it's thinner shape and the edges staying near zero for a larger section of the window. I still prefer Hann, but Blackman does very well to cut through the noise floor.
  Reply With Quote
Old 8th March 2012, 01:46 PM   #17
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
Blog Entries: 2
This file makes a sensible comparison of noise floor antics. You can see that some windows curve downward but then jump up and slowly descend to the right side of the graph. The ones that go straight down to the bottom are the ones that are meaningful for audio. Surprise surprise, Hann and Blackman are the most suitable. Whoah, Rectangular (LTSpice default "no windowing") is the WORST.

Click the image to open in full size.

From Wikipedia:

https://en.wikipedia.org/wiki/Window_function

I am seeing a difference of about .015db between rectangular and Hann windows in LTSpice with a low noise floor for each. This difference is between the 200th harmonic is of a 20KHz sine wave, though if the noise floor weren't as low the low-level harmonics would be distorted by the rectangular window. The difference increases with frequency, but this may be a noise floor effect.

Last edited by keantoken; 8th March 2012 at 01:58 PM.
  Reply With Quote
Old 8th March 2012, 02:31 PM   #18
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
Blog Entries: 2
From Wikipedia:

https://en.wikipedia.org/wiki/Window_function#Windowing

Quote:
The rectangular window has excellent resolution characteristics for signals of comparable strength, but it is a poor choice for signals of disparate amplitudes. This characteristic is sometimes described as low-dynamic-range.

...

In between the extremes are moderate windows, such as Hamming and Hann. They are commonly used in narrowband applications, such as the spectrum of a telephone channel. In summary, spectral analysis involves a tradeoff between resolving comparable strength signals with similar frequencies and resolving disparate strength signals with dissimilar frequencies. That tradeoff occurs when the window function is chosen.
So in terms of accuracy, the rectangular window would probably be the worst offender for audio work.
  Reply With Quote
Old 8th March 2012, 06:42 PM   #19
Mooly is offline Mooly  United Kingdom
diyAudio Moderator
 
Mooly's Avatar
 
Join Date: Sep 2007
I'm not really understanding a lot of this tbh.

If I post a Spice file (I'll leave it 'till tomorrow) could we work through a couple of really simple (I hope) FFT runs on it. It's some of the basics that I am stuck on such as,

1. I do a sim analysis that runs for 8ms at 1khz and get really good THD figures from the error log.

2. I increase the run time by a factor of 10, increase the number of cycles by 10 and alter the timestep accordingly and the figures are worse by a factor of hundreds... why ?

It's these basics I don't get, so if I could put the numbers in and the method I am using, then if anyone could see and advise where I am going wrong then that would be great.
__________________
-------------------------------------------------------
Installing and using LTspice. From beginner to advanced.
  Reply With Quote
Old 8th March 2012, 07:02 PM   #20
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
Blog Entries: 2
Are you using the .four command? It uses the rectangular window by default so will give falsely awful results on circuits with enough DC drift. Always sanity-check it with the FFT.

The FFT window is not really very important as long as you stick to a good one. Not much point in tweaking FFT windows for audio. Choose Hann or Blackman and leave it at that (though you will have to choose again after restarting LTSpice). Point is that the default window totally sucks for audio, it should be changed.

EDIT: I had a circuit that had great bass behavior, until I actually built it and discovered it motorboated at 1Hz, hitting the rails. It turns out this LF oscillation was causing me a lot of noise floor trouble. A while back I helped OS to find and eliminate sources of drift in simulation. In retrospect I wish I had known I could just use the Hann window. It is still useful though to get the .four command to give useful output. It may be hard to address your issues if we do not see the schematic.

DC drift shows up more in the FFT the longer time period is simulated. It can be a big problem when using the .four command at 100Hz and below.

Last edited by keantoken; 8th March 2012 at 07:16 PM.
  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 04:06 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