Electronics-Related.com
Forums

LT Spice FFT scaling

Started by John Larkin July 9, 2018

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.



-- 

John Larkin         Highland Technology, Inc
picosecond timing   precision measurement 

jlarkin att highlandtechnology dott com
http://www.highlandtechnology.com

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.
As I've harped almost continuously... with simulators, particularly of the toyLTspice variety... "fast" and "accuracy" are inversely proportional. Stop whining and learn to live with it. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | STV, Queen Creek, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | Thinking outside the box... producing elegant solutions, by understanding what nature is hiding. "It is not in doing what you like, but in liking what you do that is the secret of happiness." -James Barrie
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...
On 07/09/2018 03:00 PM, John Larkin 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. >
Change "Integration method" from "modified trap" to "Gear"
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...
As I've also harped... selecting "Alternate Solver" forces LTspice to behave in conventional Berkeley Spice fashion... no short-cuts, none of Mikey's "behavior" models that take gross liberties so that FAST (or is it HALF-FAST?) becomes the marketing line? ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | STV, Queen Creek, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | Thinking outside the box... producing elegant solutions, by understanding what nature is hiding. "It is not in doing what you like, but in liking what you do that is the secret of happiness." -James Barrie
On Mon, 09 Jul 2018 12:54:00 -0700, Jim Thompson
<To-Email-Use-The-Envelope-Icon@On-My-Web-Site.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. > >As I've harped almost continuously... with simulators, particularly of >the toyLTspice variety... "fast" and "accuracy" are inversely >proportional. >
Sure, any finite-math simulator makes errors. People are allowed to set delta-T as they like.
>Stop whining and learn to live with it.
Whining? I love LT Spice! -- John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com
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. -- John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com
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 -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | STV, Queen Creek, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | Thinking outside the box... producing elegant solutions, by understanding what nature is hiding. "It is not in doing what you like, but in liking what you do that is the secret of happiness." -James Barrie
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. -- John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com
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. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | STV, Queen Creek, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | Thinking outside the box... producing elegant solutions, by understanding what nature is hiding. "It is not in doing what you like, but in liking what you do that is the secret of happiness." -James Barrie