Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.electronics.design > #510700

Re: LT Spice FFT scaling

From Martin Brown <'''newspam'''@nezumi.demon.co.uk>
Newsgroups sci.electronics.design
Subject Re: LT Spice FFT scaling
Date 2018-07-12 09:05 +0100
Organization Aioe.org NNTP Server
Message-ID <pi7243$11fj$1@gioia.aioe.org> (permalink)
References (3 earlier) <rus7kd9kek70vrcpipe1mgbndja37m91sk@4ax.com> <bit7kd1moklrf7k3io2o97a2hhs216vn7r@4ax.com> <dl78kdle3uro475k4jl36vgi7rv0vokpsp@4ax.com> <d-qdnY0ZUfD5KdnGnZ2dnUU7-b_NnZ2d@supernews.com> <60r9kd5ennv6s7bpvmutp1p4sk7djkkd3t@4ax.com>

Show all headers | View raw


On 10/07/2018 18:26, John Larkin wrote:
> On Tue, 10 Jul 2018 09:28:02 -0400, Phil Hobbs
> <pcdhSpamMeSenseless@electrooptical.net> wrote:
> 
>> On 07/09/18 22:53, Jim Thompson wrote:
>>> On Mon, 09 Jul 2018 17:00:27 -0700, John Larkin
>>> <jjlarkin@highland_snip_technology.com> wrote:
>>>
>>>> On Mon, 09 Jul 2018 16:47:06 -0700, Jim Thompson
>>>> <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote:
>>>>
>>>>> On Mon, 09 Jul 2018 16:03:54 -0700, John Larkin
>>>>> <jjlarkin@highland_snip_technology.com> wrote:
>>>>>
>>>>>> On Mon, 09 Jul 2018 13:06:15 -0700, boB <boB@K7IQ.com> wrote:
>>>>>>
>>>>>>> On Mon, 09 Jul 2018 12:00:24 -0700, John Larkin
>>>>>>> <jjlarkin@highland_snip_technology.com> wrote:
>>>>>>>>
>>>>>>>> Suppose I create a current source that's a sine wave, amplitude 1,
>>>>>>>> frequency 1, and then run a transient response. Then plot current and
>>>>>>>> FFT. On a linear scale, it has some harmonics (no surprise) but the
>>>>>>>> amplitude of the fundamental is 690 mA.
>>>>>>>>
>>>>>>>> Why 690? Is that a bad approximation of 707?
>>>>>>>>
>>>>>>>> Update: if I set the time step to 10 us, it runs slow but the FFT
>>>>>>>> amplitude is 706.9 mA. So the FFT reports RMS.
>>>>>>>
>>>>>>>
>>>>>>> Try it also with the alternate solver ?  Will probably be the same as
>>>>>>> decreasing the step size though I imagine.  Not a lot to go wrong...
>>>>>>> go wrong.... go wrong...
>>>>>>
>>>>>> It's just a sinewave current source. There's really nothing to solve!
>>>>>> I think LT Spice just picks an ambitiously small delta-T by default.
>>>>>
>>>>> Nope.  It's a cockpit set-up error >:-}
>>>>> 		
>>>>>                                          ...Jim Thompson
>>>>
>>>> There's no operator error at all. LT Spice gives one a choice of
>>>> solver, a choice of dt, and several other params to tweak to trade off
>>>> speed against accuracy. What's wrong with that?
>>>>
>>>> I needed to know what units the FFT uses when it displays current. The
>>>> answer is RMS amps. Sinewave sources, voltage or current, use peak
>>>> amps.
>>>
>>> Except that the waveform simulated is NOT sin(wt), it's
>>> u_1(t)*sin(wt).
>>>
>>>   From which the DC offset arises.
>>
>> The DFT/FFT only applies to periodic sequences.  For a sequence periodic
>> in the FFT interval and having compact support in the frequency domain,
>> the FFT produces correct samples of the underlying continuous-time
>> transform.
>>
>> Real data, or in this case interpolated simulation data, doesn't fit
>> those conditions exactly, which leads to errors.  It's not very
>> difficult to compute an error bound in any given case.

There is a way to make an FFT give a very good approximation to a DFT in 
the case of unequally spaced data provided that the data is reasonably 
compact on the new uniform grid. You convolve the raw data with an 
interpolation function on compact support (Jodrell used to use truncated 
Gaussian, VLA used a variant prolate spheroidal bessel). This means that 
your final result is then multiplied by a scale factor that has to be 
corrected out but by keeping track of how much contribution is put into 
each cell and the cumulative value you can get a pretty good FFT out of 
data that are not uniformly spaced with minimal artefacts.

See
https://github.com/mrbell/gfft/wiki/Gridding

The paper you want is Schwab 1984 from there

http://adsabs.harvard.edu/abs/1984iimp.conf..333S

Probably no help to the OP but I think Phil will enjoy it!

> 
> I tried a couple of windowing functions (there is a huge list
> available) but they didn't change the FFT much. Smaller time steps
> really do.

Windowing functions just alter the sidebands caused by the discontinuity 
between the start and end of your time series data. If your signal is 
exactly periodic on the FFT length it should be irrelevant (and will 
only make things worse).

You might find that choosing a timescale that is an exact power of two 
will give less side effects depending on exactly how LT spice does it 
internally. Modern FFT packages can do most sizes efficiently.

I suspect you are suffering amplitude drift. We used to optimise FFT 
recurrence relations to the extent of tabulating the discrete roots of 
rN = (-1)(1/2^N) that gave least error when rN^(2^N) was computed by the 
recurrence algorithm. It was never quite the same as theory.

-- 
Regards,
Martin Brown

Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

LT Spice FFT scaling John Larkin <jjlarkin@highland_snip_technology.com> - 2018-07-09 12:00 -0700
  Re: LT Spice FFT scaling Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> - 2018-07-09 12:54 -0700
    Re: LT Spice FFT scaling John Larkin <jjlarkin@highland_snip_technology.com> - 2018-07-09 15:52 -0700
    Re: LT Spice FFT scaling Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2018-07-10 08:13 +0100
      Re: LT Spice FFT scaling Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2018-07-10 09:14 -0400
  Re: LT Spice FFT scaling boB <boB@K7IQ.com> - 2018-07-09 13:06 -0700
    Re: LT Spice FFT scaling Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> - 2018-07-09 15:14 -0700
      Re: LT Spice FFT scaling Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2018-07-10 09:24 -0400
    Re: LT Spice FFT scaling John Larkin <jjlarkin@highland_snip_technology.com> - 2018-07-09 16:03 -0700
      Re: LT Spice FFT scaling Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> - 2018-07-09 16:47 -0700
        Re: LT Spice FFT scaling John Larkin <jjlarkin@highland_snip_technology.com> - 2018-07-09 17:00 -0700
          Re: LT Spice FFT scaling Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> - 2018-07-09 19:53 -0700
            Re: LT Spice FFT scaling John Larkin <jjlarkin@highlandtechnology.com> - 2018-07-09 21:48 -0700
            Re: LT Spice FFT scaling Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2018-07-10 09:28 -0400
              Re: LT Spice FFT scaling John Larkin <jjlarkin@highland_snip_technology.com> - 2018-07-10 10:26 -0700
                Re: LT Spice FFT scaling Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2018-07-10 13:31 -0400
                Re: LT Spice FFT scaling Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2018-07-12 09:05 +0100
                Re: LT Spice FFT scaling Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2018-07-13 04:49 -0400
                Re: LT Spice FFT scaling Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2018-07-16 14:17 +0100
                Re: LT Spice FFT scaling Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2018-07-16 10:08 -0400
          Re: LT Spice FFT scaling bitrex <user@example.net> - 2018-07-09 23:09 -0400
            Re: LT Spice FFT scaling bitrex <user@example.net> - 2018-07-09 23:16 -0400
              Re: LT Spice FFT scaling John Larkin <jjlarkin@highland_snip_technology.com> - 2018-07-10 10:33 -0700
                Re: LT Spice FFT scaling bitrex <user@example.net> - 2018-07-10 17:10 -0400
                Re: LT Spice FFT scaling John Larkin <jjlarkin@highland_snip_technology.com> - 2018-07-10 14:37 -0700
                Re: LT Spice FFT scaling bitrex <user@example.net> - 2018-07-10 17:57 -0400
                Re: LT Spice FFT scaling upsidedown@downunder.com - 2018-07-11 09:19 +0300
                Re: LT Spice FFT scaling John Larkin <jjlarkin@highlandtechnology.com> - 2018-07-11 07:08 -0700
                Re: LT Spice FFT scaling makolber@yahoo.com - 2018-07-11 07:55 -0700
                Re: LT Spice FFT scaling John Larkin <jjlarkin@highlandtechnology.com> - 2018-07-11 08:32 -0700
                Re: LT Spice FFT scaling Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2018-07-12 09:18 +0100
                Re: LT Spice FFT scaling Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2018-07-12 09:14 +0100
  Re: LT Spice FFT scaling bitrex <user@example.net> - 2018-07-09 18:04 -0400
  Re: LT Spice FFT scaling Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2018-07-10 08:03 +0100
    Re: LT Spice FFT scaling bitrex <user@example.net> - 2018-07-10 17:53 -0400
      Re: LT Spice FFT scaling Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2018-07-11 09:04 +0100
  Re: LT Spice FFT scaling Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2018-07-10 08:41 -0400
    Re: LT Spice FFT scaling bitrex <user@example.net> - 2018-07-10 17:27 -0400
      Re: LT Spice FFT scaling John Larkin <jjlarkin@highland_snip_technology.com> - 2018-07-10 14:46 -0700
        Re: LT Spice FFT scaling bitrex <user@example.net> - 2018-07-10 19:37 -0400
      Re: LT Spice FFT scaling Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2018-07-11 21:17 -0400
  Re: LT Spice FFT scaling bitrex <user@example.net> - 2018-07-11 22:24 -0400
    Re: LT Spice FFT scaling Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2018-07-13 04:37 -0400
      Re: LT Spice FFT scaling Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2018-07-16 14:18 +0100

csiph-web