# Antiderivative Antialiasing for Stateful Systems +
## 5 Examples
### Diode Clipper  
As the first example, we consider the diode clipper of Figure 3.  
The circuit is simple enough that we briefly repeat the modeling process here. From [PERSON]'s and [PERSON]'s laws and \(i_{\rm C}=C\dot{y}\), we immediately obtain  
\[y=u-R\cdot(i_{\rm C}+i_{\rm D})=u-RC\cdot\dot{y}-Ri_{\rm D}. \tag{22}\]  
Summing over two subsequent sampling instances, we get  
\[y(n)+y(n-1)=u(n)+u(n-1)-RC\cdot(\dot{y}(n)+\dot{y}(n-1))-R\cdot(i_{\rm D}(n)+i_ {\rm D}(n-1)). \tag{23}\]  
We now use the trapezoidal rule to substitute  
\[\dot{y}(n)+\dot{y}(n-1)=2f_{\rm s}\cdot(y(n)-y(n-1)) \tag{24}\]  
and obtain  
\[y(n)+y(n-1)=u(n)+u(n-1)-2 RCf_{\rm s}\cdot(y(n)-y(n-1))-R\cdot(i_{\rm D}(n)+i_ {\rm D}(n-1)). \tag{25}\]  
Collecting all quantities from time step \(n-1\) into canonical states  
\[x(n-1)=(2 RCf_{\rm s}-1)\cdot y(n-1)+u(n-1)-Ri_{\rm D}(n-1) \tag{26}\]  
allows simplification to  
\[y(n)=x(n-1)+u(n)-2 RCf_{\rm s}y(n)-Ri_{\rm D}(n). \tag{27}\]  
Using [PERSON]'s equation for the diodes, we get  
\[i_{\rm D}(n)=I_{\rm S}\cdot\left(e^{y(n)/v_{\rm T}}-1\right)-I_{\rm S}\cdot \left(e^{-y(n)/v_{\rm T}}-1\right)=2I_{\rm S}\sinh\left(y(n)/v_{\rm T}\right), \tag{28}\]  
where saturation current and temperature voltage have been chosen as \(I_{\rm S}=1\,\)fA and \(v_{\rm T}=25\,\)mV respectively. Inserting (28) into (27) and introducing  
\[p_{y}(n)=x(n-1)+u(n) \tag{29}\]  
then leads to the implicit equation  
\[y(n)=p_{y}(n)-2 RCf_{\rm s}y(n)-2 RI_{\rm S}\sinh\left(y(n)/v_{\rm T}\right) \tag{30}\]  
\[y=u-R\cdot(i_{\rm C}+i_{\rm D})=u-RC\cdot\dot{y}-Ri_{\rm D}. \tag{22}\]0 Schematics of the modeled diode clipper. for \(y(n)\). Note that we do not treat this as a delay-free loop and apply the antialiasing to the \(\sinh\)-function. Instead, we let \(f_{\rm y}(p_{\rm y}(n))=y(n)\) denote the solution of the implicit equation. The resulting function is depicted in Figure 4 (obtained using an iterative solver). To obtain the state update equation, we rearrange (27) to  
\[y=u-R\cdot(i_{\rm C}+i_{\rm D})=u-RC\cdot\dot{y}-Ri_{\rm D}. \tag{22}\]1  
and note by comparing with (26) that the left-hand side equals \(x(n)\). Thus introducing  
\[y=u-R\cdot(i_{\rm C}+i_{\rm D})=u-RC\cdot\dot{y}-Ri_{\rm D}. \tag{22}\]2  
with \(p_{\rm x}(n)=p_{\rm y}(n)\), we arrive at  
\[y=u-R\cdot(i_{\rm C}+i_{\rm D})=u-RC\cdot\dot{y}-Ri_{\rm D}. \tag{22}\]3 \[y=u-R\cdot(i_{\rm C}+i_{\rm D})=u-RC\cdot\dot{y}-Ri_{\rm D}. \tag{22}\]4  
of the desired form. Applying the aliasing mitigation only to the output equation is particularly simple in this case, giving  
\[y=u-R\cdot(i_{\rm C}+i_{\rm D})=u-RC\cdot\dot{y}-Ri_{\rm D}. \tag{22}\]5  
with \(\tilde{f}_{\rm y}\) defined according to (4). The required antiderivative \(F_{\rm y}(p_{\rm y})\) of \(f_{\rm y}(p_{\rm y})\), depicted in Figure 5, has to be determined numerically. For the results below, it has been precomputed at 1024 uniformly distributed points in the relevant range and stored in a table, using cubic interpolation during lookup. \[y=u-R\cdot(i_{\rm C}+i_{\rm D})=u-RC\cdot\dot{y}-Ri_{\rm D}. \tag{22}\]6 Nonlinear function \(f_{\rm y}(p_{\rm y})\) of the diode clipper for two different sampling rates \(f_{\rm s}\). To also apply aliasing mitigation to the state update equation, we have to change it to  
\[y=u-R\cdot(i_{\rm C}+i_{\rm D})=u-RC\cdot\dot{y}-Ri_{\rm D}. \tag{22}\]7  
and substitute \(\tilde{f}_{\mathrm{s}}=\tfrac{2}{3}f_{\mathrm{s}}\) for \(f_{\mathrm{s}}\) in (30) and (32). Note that this immediately leads to  
\[y=u-R\cdot(i_{\rm C}+i_{\rm D})=u-RC\cdot\dot{y}-Ri_{\rm D}. \tag{22}\]8  
To study the effectiveness of the method, we consider Figure 6, where the output spectra for a sinusoidal excitation is depicted for various model configurations. Figure 6a,b give the baseline, the system without any aliasing mitigation at sampling rates \(f_{\mathrm{s}}=44.1\,\mathrm{kHz}\) and \(f_{\mathrm{s}}=88.2\,\mathrm{kHz}\), respectively.