Author Topic: LTspice FFT on current waveform?  (Read 4506 times)

0 Members and 1 Guest are viewing this topic.

Offline questronTopic starter

  • Regular Contributor
  • *
  • Posts: 68
LTspice FFT on current waveform?
« on: November 07, 2014, 05:36:02 am »
how could i do an FFT on a current waveform in LTspice?
i did a .four i(lc(Q1)) for example, it didn't work.

i just want the THD number on an AC current, does this make sense, doable in LTspice, what's the correct syntax for it?
googling didn't yield any results.

tks!
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21621
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: LTspice FFT on current waveform?
« Reply #1 on: November 07, 2014, 07:47:53 am »
If nothing else, do the .tran simulation, plot the waveform, then View / FFT.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Online macboy

  • Super Contributor
  • ***
  • Posts: 2252
  • Country: ca
Re: LTspice FFT on current waveform?
« Reply #2 on: November 07, 2014, 03:27:15 pm »
If nothing else, do the .tran simulation, plot the waveform, then View / FFT.

Tim
This is the way to get a graphical result. To get a tabulated list of amplitudes of harmonics, use ".four" directive. The OP is missing the frequency from the .four directive. This should work (for 1 kHz):

.four 1kHz Ic(Q1)

Also ensure that the simulation time is an exact multiple of the period of the fundamental, in order to improve the FFT result (to avoid a slant of the noise floor towards DC). Also add this directive:
  .option plotwinsize=0
...which will disable compression, which would otherwise increase distortion due to reduced precision in calculations.
« Last Edit: November 07, 2014, 03:29:17 pm by macboy »
 

Offline questronTopic starter

  • Regular Contributor
  • *
  • Posts: 68
Re: LTspice FFT on current waveform?
« Reply #3 on: November 07, 2014, 04:52:59 pm »
If nothing else, do the .tran simulation, plot the waveform, then View / FFT.

Tim

did that and got a rough idea about its distortion, thank you Tim for the help!
 

Offline questronTopic starter

  • Regular Contributor
  • *
  • Posts: 68
Re: LTspice FFT on current waveform?
« Reply #4 on: November 07, 2014, 04:59:03 pm »
If nothing else, do the .tran simulation, plot the waveform, then View / FFT.

Tim
This is the way to get a graphical result. To get a tabulated list of amplitudes of harmonics, use ".four" directive. The OP is missing the frequency from the .four directive. This should work (for 1 kHz):

.four 1kHz Ic(Q1)

Also ensure that the simulation time is an exact multiple of the period of the fundamental, in order to improve the FFT result (to avoid a slant of the noise floor towards DC). Also add this directive:
  .option plotwinsize=0
...which will disable compression, which would otherwise increase distortion due to reduced precision in calculations.

that worked beautifully, thanks a lot macboy!

didn't know the impact on slanting noise floor before, very nice and useful tip!
all is much appreciated!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf