# Algorithms for Fractional Dynamical Behaviors Modelling Using Non-Singular Rational Kernels
## 3 Algorithms to Model More General Fractional Behaviors
### A Least Squares Method to Obtain the Kernel Samples \(\eta(kT_{e})\)  
In order to obtain the kernel (3) samples \(\eta(kT_{e})\), let \(y(t)\) and \(u(t)\) be, respectively, the output and the input of this system, that is  
\[y(t)=\int_{0}^{t}\eta(t-\tau)u(\tau)d\tau. \tag{20}\]  
If \(y(t)\) and \(u(t)\) are sampled with a sampling period \(T_{e}\), then at time \(kT_{e}\), \(k\in\mathbb{N}\),  
\[y(kT_{e})=\int_{0}^{kT_{e}}\eta(\tau)u(t-\tau)=\sum_{j=1}^{k}\int_{(j-1)T_{e}}^ {jT_{e}}\eta(\tau)u(t-\tau)d\tau. \tag{21}\]  
Many numerical schemes can then be used to evaluate the integrals in (23). With Gaussian quadrature, then  
\[y(kT_{e})\approx\frac{T_{e}}{2}{\sum_{j=1}^{k}}(\eta(jT_{e})u((k-j)T_{e})+\eta ((j-1)T_{e})u((k-j+1)T_{e})). \tag{22}\]  
For \(k=1\)  
\[y(T_{e})\approx\frac{T_{e}}{2}(\eta(T_{e})u(0)+\eta(0)u(1)) \tag{23}\]  
For \(k=2\)  
\[y(2T_{e})\approx\frac{T_{e}}{2}(\eta(T_{e})u(T_{e})+\eta(0)u(2T_{e}))+\frac{T _{e}}{2}(\eta(2T_{e})u(0T_{e})+\eta(T_{e})u(T_{e})). \tag{24}\]  
For \(k=3\)  
\[y(3T_{e})\approx\frac{T_{e}}{2}(\eta(T_{e})u(2T_{e})+\eta(0)u(3T_{e}))+\frac{ T_{e}}{2}(\eta(2T_{e})u(T_{e})+\eta(T_{e})u(2T_{e}))+\frac{T_{e}}{2}(\eta(3T_{e})u( 0)+ \tag{25}\]  
\[\eta(2T_{e})u(T_{e})).\]  
For \(k=4\)  
\[y(4T_{e})\approx\frac{T_{e}}{2}(\eta(T_{e})u(3T_{e})+\eta(0T_{e})u(4T_{e}))+ \frac{T_{e}}{2}(\eta(2T_{e})u(2T_{e})+\eta(T_{e})u(3T_{e}))\]  
\[+\frac{T_{e}}{2}(\eta(3T_{e})u(T_{e})+\eta(2T_{e})u(2T_{e}))+\frac{T_{e}}{2}( \eta(4T_{e})u(0)+\eta(3T_{e})u(T_{e}))\]  
An approximation of the kernel function \(\eta(t)\) for \(t=kT_{e}\), \(k\in[1\ldots M]\), can thus be obtained by solving in the least square sense the linear system of equations  
\[\frac{T_{e}}{2} \begin{bmatrix}u(T_{e})&u(0)&0&0&0&\cdots&0\\ u(2T_{e})&2u(T_{e})&u(0)&0&\cdots&0\\ u(3T_{e})&2u(2T_{e})&2u(T_{e})&u(0)&0&\cdots&0\\ u(4T_{e})&2u(3T_{e})&2u(2T_{e})&2u(T_{e})&u(0)&\cdots&0\\ \vdots&\vdots&\vdots&\vdots&\vdots&\ddots&\vdots\\ u(MT_{e})&&&&&&&u(0)\end{bmatrix}\begin{bmatrix}\eta(0)\\ \eta(T_{e})\\ \eta(2T_{e})\\ \eta(3T_{e})\\ \vdots\\ \eta(MT_{e})\end{bmatrix} = \begin{bmatrix}y(T_{e})\\ y(2T_{e})\\ y(3T_{e})\\ \vdots\\ y(4T_{e})\\ \vdots\\ y(MT_{e})\end{bmatrix} , \tag{27}\]  
obtained by writing the expression of output \(y(kT_{e})\) given by relation (24) for \(k\in[1\ldots M]\). In order to evaluate the efficiency of this algorithm, it is applied to the data produced by the fractional model:  
\[H(s)=K\frac{\left(\frac{s^{y}}{\omega_{1}}+1\right)\left(\frac{s^{y}}{\omega_{ 2}}+1\right)}{s\left(\frac{s^{y}}{\omega_{p1}}+1\right)\left(\frac{s^{y}}{ \omega_{p2}}+1\right)} \tag{28}\]  
with \(\
u=0.5\), \(K=5\), \(\omega_{21}=1000\) rd/s, \(\omega_{22}=5000\) rd/s, \(\omega_{p1}=0.001\) rd/s, \(\omega_{p2}=100\) rd/s. After partial fraction expansion of the transfer function (30), the exact impulse response of the transfer function \(H(s)\) is given by:  
\[\eta_{f}(t)=K+\frac{A_{1}}{\sqrt{\pi t}}+A_{2}t^{\
u-1}E_{\
u,\
u}\big{(}{-\omega _{p2}t^{\
u}}\big{)}+A_{3}t^{\
u-1}E_{\
u,\
u}\big{(}{-\omega_{p1}t^{\
u}}\big{)} \tag{29}\]  
with  
\[A_{1}=K\frac{\omega_{p1}\omega_{p2}\omega_{z1}+\omega_{p1}\omega_{p2}\omega_{ z2}-\omega_{p1}\omega_{z2}\omega_{z1}-\omega_{p2}\omega_{z2}\omega_{z1}}{\omega_{z 1}\omega_{z2}\omega_{p1}\omega_{p2}} \tag{30}\]  
\[A_{2}=K\omega_{p1}\frac{{\omega_{p2}}^{2}{-\omega_{p2}\omega_{z1}-\omega_{p2} \omega_{z2}+\omega_{z2}\omega_{z1}}}{\omega_{z1}\omega_{z2}\omega_{p2}\big{(} \omega_{p1}-\omega_{p2}\big{)}} \tag{31}\]  
\[A_{3}=-K\omega_{p2}\frac{{\omega_{p1}}^{2}{-\omega_{p1}\omega_{z1}-\omega_{p1 }\omega_{z2}+\omega_{z2}\omega_{z1}}}{\omega_{z1}\omega_{z2}\omega_{p1}\big{(} \omega_{p1}-\omega_{p2}\big{)}} \tag{32}\]  
To generate data, the pseudo-random binary sequence of Figure 5 is used as an input of the transfer function \(H(s)\). In Figure 6, the function \(\eta(t)\) estimated using the algorithm described above is compared to the function \(\eta_{f}(t)\).