LTSpice FFT simulation settings and inconsistent results. - Page 9 - diyAudio
 LTSpice FFT simulation settings and inconsistent results.
 User Name Stay logged in? Password
 Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read Search

 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
nowhere
diyAudio Member

Join Date: Jun 2012
Quote:
 Originally Posted by keantoken Firstly, though I am resisting, I'm glad for your input on this matter, so I'm not thinking in a vacuum. I am trying to come up with a valid test that doesn't take an indefinite number of hours to simulate.
Before you resist any further.

There is the original continuous Fourier transform expressed through integral from minus to plus infinity. That Fourier transform spectrum is a continuum (opposed to discrete set) of obviously periodic sine waves.

Because of the continuum many practical non-periodic functions can be represented by superposition of periodic sine waves.

At the moment you use DFT (Discrete Fourier Transform), "you are toast".

The set of sine waves in DFT is discrete, that't why when you reconstitute input signal from its DFT spectrum, you produce a periodic function even if the input function is not periodic.

If you take, for example, exponential decay: f(t) = exp(-t / tau) where tau > 0, and run DFT on it, and then reconstitute the function, then within the N samples the reconstituted function will perfectly match the input one, but outside the buffer it will mismatch.

A numerical example. Suppose N = 8, and sampling period is 1 and tau is 1. I.e. our f(t) is exp(-k) where k is sample number.

Since N = 8, we have:

f(0) = 1
f(1) = exp(-1) = 0.367879,
f(2) = exp(-2) = 0.135335,
...
f(7) = exp(-7) = 0.000911882 - this is our last sample,
f(8)= exp(-8) = (0.000335463 - first sample after our N = 8 samples.

If you run perfect DFT, you'll get the same numbers for f(0) .. f(7), but for f(8) you'll again get 1 because for our N = 8 f(8) is the same f(0) because of periodicity.

No windowing can fix this. That's why simply wait until non-periodic components of your signal die down/out.

 19th June 2012, 01:50 PM #82 keantoken   diyAudio Member     Join Date: Aug 2006 Location: Texas Oh, I actually already figured out that it was non-periodic spectra causing the problems, though without the confirmation of math. I knew that windowing was only a workaround for that. But about windowing distortions, I had the idea that the Hann windows, taken sequentially, overlapped and due to the symmetric bell curve, summed to 1 all across like you would hope for the crossover points of a speaker, thus resulting in no distortion. It seemed so elegant to me and nothing in the articles I (tried to) read suggested otherwise. Is this not how it works? Again I thank you for shining some light on my dim constructions, and this knowledge will be helpful to users new to simulation. Also: it seems you have adequate knowledge to implement things such as FFT resampling, which to my knowledge is exact as opposed to interpolation, which can be no more than an approximation. There are image editors that do a graphical FFT of the image which you can draw or erase on, and this allows you to do interesting things like remove noise from the image without altering other details. Couldn't the same be done with FFT on a music file? Furthermore, FFT image resizing would also be better than any interpolating resizer, and would be very useful on small images that would be corrupted by interpolation. It surprises me that no one seems to have done this yet, except for researchers: http://www.kgsepg.com/download.php?f...ampling_in.pdf I would like to try something like this with FFTW, but I just started learning assembly as my first language (Only reasonable...?) and I can tell that may be a long ways off. __________________ The Kmultiplier rail filter! -=- The Simple Kuartlotron Superbuffer! Need something built, repaired or modded? PM me and ask what I can do!
nowhere
diyAudio Member

Join Date: Jun 2012
Quote:
 Originally Posted by keantoken Oh, I actually already figured out that it was non-periodic spectra causing the problems, though without the confirmation of math. I knew that windowing was only a workaround for that. But about windowing distortions, I had the idea that the Hann windows, taken sequentially, overlapped and due to the symmetric bell curve, summed to 1 all across like you would hope for the crossover points of a speaker, thus resulting in no distortion. It seemed so elegant to me and nothing in the articles I (tried to) read suggested otherwise. Is this not how it works? Again I thank you for shining some light on my dim constructions, and this knowledge will be helpful to users new to simulation. Also: it seems you have adequate knowledge to implement things such as FFT resampling, which to my knowledge is exact as opposed to interpolation, which can be no more than an approximation. There are image editors that do a graphical FFT of the image which you can draw or erase on, and this allows you to do interesting things like remove noise from the image without altering other details. Couldn't the same be done with FFT on a music file? Furthermore, FFT image resizing would also be better than any interpolating resizer, and would be very useful on small images that would be corrupted by interpolation. It surprises me that no one seems to have done this yet, except for researchers: http://www.kgsepg.com/download.php?f...ampling_in.pdf I would like to try something like this with FFTW, but I just started learning assembly as my first language (Only reasonable...?) and I can tell that may be a long ways off.
"I had the idea that the Hann windows, taken sequentially, overlapped and due to the symmetric bell curve, summed to 1 all across" - that is correct. It is also correct for Hamming window. And for triangular window. And probably for many others.

However, this is absolutely correct for stationary signal which, because it is stationary, is also periodic.

With non-stationary signal not everything caused by the amplitude modulation inflicted by windowing cancels out, even though for the majority of practical applications it's quite OK. The bigger is N, the better.

Regarding resampling - how about using "off the shelf" SoX ( SoX - Sound eXchange | HomePage ) polyphase resampling ? See, for example, Sox Resample and Polyphase rate changes and there look for "polyphase conversion".

Anyway, you can't fool nature/math. Resampling is interpolation over 'sinc' function ( Sinc function - Wikipedia, the free encyclopedia ), in order for resampling to be perfect one needs full length 'sinc' function which is infinity.

However, one can choose sufficiently long for any required accuracy length of 'sinc' function.

...

In simple English: overlapping windows is good for streaming audio.

gootee
diyAudio Member

Join Date: Nov 2006
Location: Indiana
Quote:
 Originally Posted by keantoken Firstly, though I am resisting, I'm glad for your input on this matter, so I'm not thinking in a vacuum. I am trying to come up with a valid test that doesn't take an indefinite number of hours to simulate.
If you are iteratively running simulations and calculating THD or DFT, with small changes to the circuit, maybe you could speed up the settling time by specifying all of the initial conditions, with .ic, e.g. all of the capacitor voltages, et al.

 1st July 2012, 12:15 PM #85 keantoken   diyAudio Member     Join Date: Aug 2006 Location: Texas I have found one way to eliminate the sine wave starting spike at turn-on is to add another source with the frequency {Freq+Freq/numcyc}. This gives the input signal a sine burst-like behavior, with an envelope spanning the simulation range. The two sources initially cancel. There is still some abruptness, but it's much reduced from an ordinary sine and it decreases inversely with the total simulation time, as the second source frequency moves closer to the fundamental. This method allows to not use any rev cycles, so simulation starts plotting from the beginning. It is especially helpful in troubleshooting anomalous behavior and oscillation that slows the simulator to a crawl before the plotting starts. It also gives a much better indication of dynamic behavior. I kinda wonder if I shouldn't have been doing this all a long. The problem with this approach is that it's unconventional, so the results cannot necessarily be interpreted normally, although in my experience it gives equivalent THD figures. One problem is that the peak level is twice as high as the effective level where distortion is measured, so you can't measure distortion at levels higher than half clipping volume. __________________ The Kmultiplier rail filter! -=- The Simple Kuartlotron Superbuffer! Need something built, repaired or modded? PM me and ask what I can do!
 1st July 2012, 08:37 PM #86 Jay   Banned   Join Date: Feb 2003 Location: Jakarta Kean, you seem to approach the problem pure from electronics side, not IT/software side (I thought you learn assembly language?). From software side, we look at the speed of processing from how the software is written. How it manages memory and files. From software functionality point of view, we may be interested in some setups and commands such as .SAVE, .SAVEBIAS/.LOADBIAS. From software troubleshooting point of view, we may be interested in overflows and flaws in the algorithms. Honestly, I think something is wrong but I still don't know what/why.
 1st July 2012, 08:56 PM #87 keantoken   diyAudio Member     Join Date: Aug 2006 Location: Texas I never thought of making a rig based on savebias stuff. I would have explored this earlier, but when designing an amp so much changes, the operating points are changing all the time, so the saved values are always invalid, so you will have to run extra simulation every time to find the right operating point anyway. I wondered if something were wrong with LTSpice. After learning more about FFT I think this is normal, it's just other simulators hide it or work around it somehow. There would not really be a problem if the LTSpice solved the operating point to a reasonable accuracy each time. __________________ The Kmultiplier rail filter! -=- The Simple Kuartlotron Superbuffer! Need something built, repaired or modded? PM me and ask what I can do!
 19th June 2013, 10:44 AM #88 Mooly   diyAudio Moderator     Join Date: Sep 2007 Lol, I'm the last person to ask on setting up a simulation but in this case I think your problem comes down to all the time constants in the circuit... lets see what I can make of it.
 19th June 2013, 10:47 AM #89 padamiecki   diyAudio Member   Join Date: Mar 2004 Location: Krakow Dear Mooly in meantime I have found the solution, there was enough to place voltage sources with read earlier voltages instead of large caps... __________________ regards, Pawel
Mooly
diyAudio Moderator

Join Date: Sep 2007
OK. I got this anyway,
Attached Images
 Capture.JPG (117.4 KB, 86 views)

 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 Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Site     Site Announcements     Forum Problems Amplifiers     Solid State     Pass Labs     Tubes / Valves     Chip Amps     Class D     Power Supplies     Headphone Systems Source & Line     Analogue Source     Analog Line Level     Digital Source     Digital Line Level     PC Based Loudspeakers     Multi-Way     Full Range     Subwoofers     Planars & Exotics Live Sound     PA Systems     Instruments and Amps Design & Build     Parts     Equipment & Tools     Construction Tips     Software Tools General Interest     Car Audio     diyAudio.com Articles     Music     Everything Else Member Areas     Introductions     The Lounge     Clubs & Events     In Memoriam The Moving Image Commercial Sector     Swap Meet     Group Buys     The diyAudio Store     Vendor Forums         Vendor's Bazaar         Sonic Craft         Apex Jr         Audio Sector         Acoustic Fun         Chipamp         DIY HiFi Supply         Elekit         Elektor         Mains Cables R Us         Parts Connexion         Planet 10 hifi         Quanghao Audio Design         Siliconray Online Electronics Store         Tubelab     Manufacturers         AKSA         Audio Poutine         Musicaltech         Aussie Amplifiers         CSS         exaDevices         Feastrex         GedLee         Head 'n' HiFi - Walter         Heatsink USA         miniDSP         SITO Audio         Twin Audio         Twisted Pear         Wild Burro Audio

 Similar Threads Thread Thread Starter Forum Replies Last Post tiagor Solid State 32 22nd December 2012 09:33 PM Mooly Solid State 11 24th February 2012 06:44 PM ray_moth Tubes / Valves 5 6th May 2010 07:07 AM nicholas1113 Solid State 2 15th November 2009 07:52 AM ray_moth Software Tools 11 12th August 2008 07:43 PM

 New To Site? Need Help?

All times are GMT. The time now is 12:50 PM.