# How to specify the time as a dependent variable inside 'INTEG' or 'AVG' in LTSPICE?

My aim is to calculate the average and integral of a function. I have already used step function (.step param...). Right now I was using .meas to do this operation, but in that I have to mention the time as 2 to 3 ns or a range like that. I wish to integrate for a range of 2 ns to time taken by the node to reach 1.4 volt (that time varies for different .step inputs). So how can I specify that?

• Give us a minimal schematic that illustrates the problem. Something concrete to work with. Much good can be had from a clear example.
– jonk
Commented Jul 11, 2021 at 5:03
• I am extremely sorry ,Is the question clear now? @jonk Commented Jul 11, 2021 at 8:05

It is not so clear to me what you are trying to achieve, but maybe one of the following measurements might help you:

Case 1: Integrate $$\V(vdd)\$$ from $$\t=3ns\$$ to $$\t=5ns\$$

.meas VAVG AVG V(vdd) FROM 3n to 5n

Case 2: Integrate $$\V(vdd)\$$ from $$\t=3ns\$$ until $$\V(q_t)=1.4V\$$

.meas VAVG AVG V(vdd) FROM 3n TARG V(q_t)=1.4

Case 3: In case $$\V(q_t)=1.4V\$$ is reached before $$\t=3ns\$$, the average will be calculated "backwards", meaning from $$\t(V(q_t)=1.4V)\$$ to $$\t=3ns\$$.

If you want to avoid it, you can tell LTSpice to search for $$\t(V(q_t)=1.4V)\$$ after a given delay:

.meas VAVG AVG V(vdd) FROM 3n TARG V(q_t)=1.4 TD 3n