Author Topic: LTSpice pulse options  (Read 6737 times)

0 Members and 2 Guests are viewing this topic.

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #25 on: May 06, 2019, 07:31:09 pm »
An example:
The square red or green wave/trace you see in the picture has unlimited numbers of "points".
The rising and falling edges are there, in those unlimited numbers.. You cannot see them because of set zoom. You can zoom in, however.

I selected 16.7mil of them for FFT.

I can select the entire 10ns transient sim time for FFT. And the trace will be split into the 16.7mil points.


« Last Edit: May 06, 2019, 07:38:02 pm by imo »
Readers discretion is advised..
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #26 on: May 06, 2019, 07:36:34 pm »
So what is the smalest time step in the simulation for?
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #27 on: May 06, 2019, 07:38:40 pm »
Sorry it's the maximum not the minimum i am looking at. So presumably it decides the minimum by itself and is then allowed to use up to the maximum when it detects a steady state condition.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #28 on: May 06, 2019, 07:51:01 pm »
Spice is adjusting the "time steps" dynamically during the transient simulation such it gets best results within required voltage/current tolerances.

Imagine you do transient analysis 1sec long of a circuit.
When the circuit is "smooth enough" (from math point) it uses "large steps".
When there is a lot of nonlinearities (ie complex highly nonlinear models), the time step could decrease such the iteration results are "smooth enough".
There is not such setting like min step therefore.

You may set for the transient analysis a "maximum timestep" that forces the solver not to use "large" steps when the iterations are already within the abs/rel V/A tolerances.
« Last Edit: May 06, 2019, 08:04:23 pm by imo »
Readers discretion is advised..
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #29 on: May 06, 2019, 07:57:15 pm »
And the FFT on 1'000 cycles is completely different from what it is on 20 cycles
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #30 on: May 06, 2019, 08:17:39 pm »
The both are the same, but you see different details.
See below.
A 500GHz square wave from my above example - upper is 100ps long transient analysis, lower is 5000ps long one.
No windowing, 260k samples.
The spectra are the same afaik.. :)
« Last Edit: May 06, 2019, 08:21:12 pm by imo »
Readers discretion is advised..
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #31 on: May 06, 2019, 08:22:26 pm »
So if I do FFT over a smaller period it will give a larger frequency sweep.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #32 on: May 06, 2019, 08:26:12 pm »
Below the same with 100ps and 5000ps long waveform.
16.7mil points FFT, B-H window.
Again, the spectra are the "same", where the bottom one (5000ps long) has got much lower min frequency in the spectra, AND, it is much more detailed.

Fundamental is 500GHz, square-wave where the rise is 0.1ps and fall is 0.3ps.
« Last Edit: May 06, 2019, 08:31:41 pm by imo »
Readers discretion is advised..
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #33 on: May 06, 2019, 08:34:57 pm »
i am getting the reverse, 1s of data gets an FFT from 1Hz to 8MHz, but for 20ms it goes to about 300MHz from 50Hz. But below 1KHz there is no useful data and there is data well beyound the 100MHz.

Is this all predictable? or do I have to guess and play around when I want to look at specific frequencies?
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #34 on: May 06, 2019, 08:45:38 pm »
So if I do FFT over a smaller period it will give a larger frequency sweep.

With constant N FFT points a shorter transient analysis duration gets "smaller FFT sampling time steps" - therefore the max spectral freq is higher.

Again, the time domain waveform coming from transient analysis is "smooth" with none "time steps".
Readers discretion is advised..
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #35 on: May 06, 2019, 08:51:55 pm »
i am getting the reverse, 1s of data gets an FFT from 1Hz to 8MHz, but for 20ms it goes to about 300MHz from 50Hz. But below 1KHz there is no useful data and there is data well beyound the 100MHz.

Is this all predictable? or do I have to guess and play around when I want to look at specific frequencies?

Sure it is predictable.

Let the transient analysis is "ta" seconds long.
Let the number of the FFT points is N.

Then you will get N/2 spectral lines and* the highest spectral line is

fmax = (N/2)/ta

and the lowest spectral line is

fmin = 1/ta

or something like that :)

PS: An example:

ta = 20ms
N = 16.7mil
fmax = 417MHz
fmin = 50Hz

ta = 1s
N = 16.7mil
fmax = 8.35MHz
fmin = 1Hz

* the spectra is again "smooth" with theoretical max N/2 spectral lines.
« Last Edit: May 06, 2019, 09:31:17 pm by imo »
Readers discretion is advised..
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #36 on: May 06, 2019, 09:10:39 pm »
And as always you may zoom in into the spectra:

PS: in order to get the best spectra you have to apply a Windowing function before you do the FFT.
There are dozens of W functions, each suitable for a specific case.
LTSpice offers many.
Otherwise it is a rocket science..
« Last Edit: May 06, 2019, 09:25:34 pm by imo »
Readers discretion is advised..
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #37 on: May 09, 2019, 06:44:02 am »
OK, thanks, if the shorter data still yields results then it makes sense with the shorter data. I thought the idea of FFT was to assume that the portion of signal supplied repeats itself over and over to infinity.
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: LTSpice pulse options
« Reply #38 on: May 09, 2019, 07:52:32 am »
OK, thanks, if the shorter data still yields results then it makes sense with the shorter data. I thought the idea of FFT was to assume that the portion of signal supplied repeats itself over and over to infinity.

Yes exactly, it repeats itself, this is why windowing or at least padding with zeros is recommended to attenuate the artifacts generated by the wraparound. The artifacts are even more dramatic when you try to restore the original signal from its FFT spectrum, you might have a look on this : https://www.eevblog.com/forum/beginners/fft-and-signals/msg2321997/#msg2321997
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #39 on: May 14, 2019, 03:09:30 pm »
So I assume the period of time i analyse should correspond to the signal period so that when it wraps it's a carrect signal.
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: LTSpice pulse options
« Reply #40 on: May 14, 2019, 04:44:41 pm »
So I assume the period of time i analyse should correspond to the signal period so that when it wraps it's a carrect signal.

Or even to many signal periods, depending on the frequency resolution you need.  To examine the harmonic content of a signal one period will be sufficient but if you want to measure the phase noise of your signal then you need many periods (although I suppose there won't often be any phase noise in simulations, maybe except when you want to simulate a PLL capturing dynamics).
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #41 on: May 15, 2019, 06:30:28 am »
I'm just looking at RC filtered waveforms and square waves with various rise/fall times.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf