Author Topic: Setting the bounds for integration LTSpice  (Read 2405 times)

0 Members and 1 Guest are viewing this topic.

Offline EteslaTopic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Setting the bounds for integration LTSpice
« on: October 29, 2019, 02:13:15 pm »
Hi all
Is it possible to set the bounds for the LTSpice idt() function? I am trying to use the average value of a waveform. The average I am talking about is the moving average calculated from the most recent 5 seconds of the waveform. It would be easy if I could integrate the waveform from (time-5) to (time), but I don't see an easy way to do it. Any suggestions?
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: Setting the bounds for integration LTSpice
« Reply #1 on: October 29, 2019, 02:34:00 pm »
The idt() function integrates from the beginning of the simulation, although there are means of resetting the integration (see the online help, 'a' parameter). There's also an alternate way of resetting it with the idtmod() function.

For a moving average, neither would be very helpful. (You could use them to compute averages in "chunks", but that's not what you asked for.)

I think you could use the following "trick" though (assuming 'x' here is the expression in question):

Code: [Select]
idt(x - delay(x, 5))

The delay() function yields a delayed version of its parameter. The above would just be equivalent to subtracting the integral of the signal 'x' delayed by 5s from the integral of the signal 'x', which should give you what you want.

Don't hesitate to report back if it works fine or if you need further help.
 
The following users thanked this post: Etesla

Online iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: Setting the bounds for integration LTSpice
« Reply #2 on: October 29, 2019, 05:41:38 pm »
Not sure this is what you are looking for, but you may do average from time A to B in the waveform viewer (ctrl leftclick on the waveform's label on top).
Readers discretion is advised..
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf