Can someone help me to understand this formula.

46 Views Asked by At

Im trying to implement this in code, but I'm having some difficulties to understand it.

• Using precalculation: $$\exp\left(-\frac{T}{T_f}\right) = 1 - \frac{T}{T_f} + \frac{1}{2}\left(\frac{T}{T_f}\right)^2 – \frac{1}{6}\left(\frac{T}{T_f}\right)^3$$ $$\exp\left(-\frac{T}{T_s}\right) = 1 - \frac{T}{T_s} + \frac{1}{2}\left(\frac{T}{T_s}\right)^2 – \frac{1}{6}\left(\frac{T}{T_s}\right)^3$$

\begin{align*} y(n) &= y_1(n) + y_2(n) \\ &=G_f\left[1 − \exp\left(-\frac{T}{T_f}\right)\right]u(n) + \exp\left(-\frac{T}{T_f}\right) y_1 (n − 1) \\ &=G_s\left[1 − \exp\left(-\frac{T}{T_s}\right)\right]u(n) + \exp\left(-\frac{T}{T_s}\right) y_2(n − 1) \end{align*}

where: $u(n) = \mathrm{current}^2$

$y(n-1) =$ previous step

$T_s$, $T_f$, $G_s$ and $G_f$ are variables given by the user.

$T$ sampling frequency in ms

the way I understand it is: $y_1(n)$ = $G_f$ * (1 - pre calculate value) * current + pre calculate value * $y_1$ previous calculation.

am I assuming it right?

thanks