# Dynamic Response Analysis of Structures Using Legendre-Galerkin Matrix Method
## 3 Legendre-Galerkin Matrix Method
### Expression of the LGM Method  
Assuming that Equation (14) has a unique solution under the initial conditions in Equation (15), the goal is to find an approximate analytical solution to Equation (14) using the discretized Legendre series as below:  
\[y_{i,N}(t)=\sum_{m=0}^{N}a_{i,m}L_{m}^{*}(t)=\mathbf{A}_{i,N}^{T}\mathbf{\Phi }_{N}(t)\ \, \tag{26}\]  
where,  
\[ \begin{array}{l}\mathbf{A}_{i,N}=[a_{i,0}\ a_{i,1}\ \ldots\ a_{i,N}]^{T},\\ \mathbf{\Phi}_{N}(t)=[L_{0}^{*}(t)\ L_{1}^{*}(t)\ \ldots\ L_{N}^{*}(t)].\end{array}  \tag{27}\]  
The matrix form of the derivative vector will be:  
\[\frac{d}{dt}\mathbf{\Phi}_{N}(t)=\mathbf{D}\mathbf{\Phi}_{N}(t), \tag{28}\]  
where \(\mathbf{D}\) is a matrix of dimensions \((N+1)\ \times(N+1)\) and is obtained as below:  
\[\mathbf{D}=[d_{ij}]=\left\{ \begin{array}{ll}\frac{2(2j+1)}{L},&for\ \ j=i-k,\\ \end{array} \right.\left\{ \begin{array}{ll}k=1,3,\ldots,N&\mbox{if $\mathrm{N}$ is odd number},\\ k=1,3,\ldots,N-1&\mbox{if $\mathrm{N}$ is even number},\end{array} \right. \tag{29}\]  
For example, for different values of \(\mathrm{N}\), the following equations are obtained:  
\[ \begin{array}{lclcl}If&N=1&\rightarrow&\mathbf{D}=\left[\begin{array}{ll }0&0\\ \frac{2}{L}&0\end{array}\right]\\ If&N=2&\rightarrow&\mathbf{D}=\left[\begin{array}{ll}0&0&0\\ \frac{2}{L}&0&0\\ 0&\frac{6}{L}&0\end{array}\right]\\ If&N=3&\rightarrow&\mathbf{D}=\left[\begin{array}{ll}0&0&0&0\\ \frac{2}{L}&0&0&0\\ 0&\frac{6}{L}&0&0\\ \frac{2}{L}&0&\frac{10}{L}&0\end{array}\right]\end{array} \]  
Using Equation (27), the \(k\)-th derivative of \(\mathbf{\Phi}_{N}(t)\) vector is:  
\[\frac{d^{k}}{dt^{k}}\mathbf{\Phi}_{N}(t)=\mathbf{D}^{k}\mathbf{\Phi}_{N}(t), \tag{30}\]  
Therefore, by replacing \(k=1\) and \(2\) in Equation (29), and then combining the results with Equation (25), one can write:  
\[\dot{y}_{i,N}(t)=\sum_{m=0}^{N}a_{i,m}L_{m}^{*}(t)=\mathbf{A}_{i,N}^{T}\mathbf{ D}\mathbf{\Phi}_{N}(t), \tag{31}\]and  
\[\ddot{y}_{i,N}(t)=\sum_{m=0}^{N}a_{i,m}L_{m}^{*}(t)=\mathbf{A}_{i,N}^{T}\mathbf{D }^{2}\Phi_{N}(t). \tag{32}\]  
Moreover, the functions \(p_{i}(t)\) can be shown in matrix form as follows:  
\[p_{i}(t)=\sum_{m=0}^{N}p_{i,m}L_{m}^{*}(t)=\mathbf{P}_{i,N}^{T}\Phi_{N}(t), \tag{33}\]  
where \(\mathbf{P}_{i,N}^{T}\) is a (\(N+1\)) dimensional vector with the following expression:  
\[\mathbf{P}_{i,N}=\left[p_{i,0}\ p_{i,1}\ \ldots\ p_{i,N}\right]^{T}, \tag{34}\]  
where,  
\[p_{i,m}=\frac{2m+1}{L}{\int_{0}^{L}p_{i}(t)L_{m}^{*}(t)dt}. \tag{35}\]  
By introducing Equations (25) and (30)-(32) in Equation (14), it is thus possible to obtain:  
\[\sum_{j=1}^{f}\left\{m_{ij}\mathbf{A}_{j,N}^{T}\mathbf{D}^{2}+c_{ij}\mathbf{A }_{j,N}^{T}\mathbf{D}+k_{ij}\mathbf{A}_{j,N}^{T}\right\}\Phi_{N}(t)=\mathbf{P} _{i,N}^{T}\Phi_{N}(t) \tag{36}\]  
Now, let us assume that:  
\[\mathbf{Y}_{N}=\mathbf{A}\Phi_{N}(t)=\left[ \begin{array}{c}y_{1,N}\\ y_{2,N}\\ \vdots\\ y_{f,N}\end{array} \right],\ \ \mathbf{A}=\left[ \begin{array}{c}\mathbf{A}_{1,N}^{T}\\ \mathbf{A}_{2,N}^{T}\\ \vdots\\ \mathbf{A}_{f,N}^{T}\end{array} \right],\ \ \mathbf{P}=\left[ \begin{array}{c}\mathbf{P}_{1,N}^{T}\\ \mathbf{P}_{2,N}^{T}\\ \vdots\\ \mathbf{P}_{f,N}^{T}\end{array} \right], \tag{37}\]  
\[\mathbf{M}=\left[m_{ij}\right],\ \ \mathbf{C}=\left[c_{ij}\right],\ \ \mathbf{K}=\left[k_{ij}\right],\ \ \ i,j=1,2,\ldots,f,\]  
where \(\mathbf{Y}_{N}\) is an \(f\) dimensional vector, \(\mathbf{A}\) and \(\mathbf{P}\) are \(f\times(N+1)\) dimensional and \(\mathbf{M}\), \(\mathbf{C}\) and \(\mathbf{K}\) are the known \(f\times f\) dimensional matrices, respectively.