2

Even though this question is DSP related, I am interested in the math behind the algorhitm discussed below.

To give some background: I'm working with power frequency (50/60Hz) AC signals and need to compute the integral of an input signal in real time. The sample rate is periodically adjusted so that we always have 16 samples per cycle.

While trying to implement the Simpson's integration algorhitm in a microcontroller, given by the following difference equation:

$$ y[n] = \frac{T}{3}(x[n] + 4x[n-1] + x[n-2]) + y[n-2] $$ where $T$ is the sampling period, I came across this first order algorhitm by mistake: $$ y[n] = \frac{T}{k}(x[n] + (k-1)x[n-1]) + y[n-1] $$ where $k$ is a real constant. Notice that for $k=2$, we have the Trapezoid Method.

I tested this algorhitm in Scilab using different values for $k$ and found out that by increasing $k$ up to $k=11$, the convergence error decreases, and then increses again for $k>11$. Again, this was tested only using sine waves + noise.

This method, instead of considering the area of the trapezoid defined by $x[n]$, $x[n-1]$ and $T$: $$T\frac{x[n] + x[n-1]}{2}$$ Considers instead the area of the rectangle given by $x[n-1]$ and $T$ plus a triangle given by $x[n]$, $x[n-1]$ and $T$ with its height scaled by $k/2$:

$$ Tx[n-1] + T\frac{2}{k}\frac{x[n]-x[n-1]}{2} $$

Like if you were to decrease the slope of the trapezoid.

The question is: Why this algorhitm gives better results than the Trapezoid method? (at least for sine waves). Any help on how to analyse this will be appreciated.

0 Answers0