
Home  Forums  Rules  Articles  diyAudio Store  Gallery  Wiki  Blogs  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 

Thread Tools  Search this Thread 
19th June 2012, 12:34 PM  #81  
diyAudio Member
Join Date: Jun 2012

Quote:
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 nonperiodic 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 nonperiodic components of your signal die down/out. 

19th June 2012, 01:50 PM  #82 
diyAudio Member

Oh, I actually already figured out that it was nonperiodic 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! 
19th June 2012, 02:58 PM  #83  
diyAudio Member
Join Date: Jun 2012

Quote:
However, this is absolutely correct for stationary signal which, because it is stationary, is also periodic. With nonstationary 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. 

19th June 2012, 10:57 PM  #84 
diyAudio Member

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

I have found one way to eliminate the sine wave starting spike at turnon is to add another source with the frequency {Freq+Freq/numcyc}. This gives the input signal a sine burstlike 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 
diyAudio Member
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 
diyAudio Member

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 
diyAudio Moderator

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.
__________________
 Installing and using LTspice. From beginner to advanced. 
19th June 2013, 10:47 AM  #89 
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 
19th June 2013, 11:05 AM  #90 
diyAudio Moderator

OK. I got this anyway,
__________________
 Installing and using LTspice. From beginner to advanced. 
Thread Tools  Search this Thread 


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? 