# How to find discrete integral given different time intervals.

I want to implement a PID controller and I'm unsure of how to find the integration part. Normally the integral is calculated as $\sum_{n=1}^{t} e_{n}$, where $e_n$ is the sample error at time n. However, this assumes that the time intervals are all the same. In my case the timer intervals are different So how I find the integral ?

-

just multiply by the time interval think of it like areas of rectangles

-

However, this assumes that the time intervals are all the same. Why did u decide so?

The contribution from the integral term is proportional to both the magnitude of the error and the duration of the error. And there is no any requirement for equality of time intervals.

So, u can sum all error for different time intervals.

-