Can any on help me understand how from the simple delta function on the right hand and performing the integration we can get values as in the left? Note that $h = x_i + 1 - x_i$
The diffusion and mass matrices are given by $$D_{ij} = \int_0^L \frac{d\phi_i}{dx}\frac{d\phi_j}{dx} dx = \left\{\begin{matrix} \frac{1}{h_1} &\text{if } i=j=1,\\ \frac{1}{h_{i-1}} + \frac{1}{h_{i}} &\text{if } i=j\neq 1 \text{ and } N_E +1,\\ \frac{1}{h_{N_E}} &\text{if } i=j=N_E+1,\\ -\frac{1}{h_{i}} &\text{if } j=i+1,\\ -\frac{1}{h_{i-1}} &\text{if } j=i-1,\\ 0 &\text{otherwise.} \end{matrix}\right.$$
and
$$M_{ij} = \int_0^L \phi_i \phi_j dx = \left\{\begin{matrix} \frac{1}{3}h_1 &\text{if } i=j=1,\\ \frac{1}{3}(h_{i-1} + h_i) &\text{if } i=j\neq 1 \text{ and } N_E +1,\\ \frac{1}{3}h_{N_E} &\text{if } i=j=N_E+1,\\ \frac{1}{6}h_{i} &\text{if } j=i+1,\\ \frac{1}{6}h_{i-1} &\text{if } j=i-1,\\ 0 &\text{otherwise.} \end{matrix}\right.$$
And the shape functions satisfy the condition $\phi_i(x_j) = \delta_{i,j}$ is the Kronecker delta.
References
- Pozrikidis, Constantine. Introduction to finite and spectral element methods using MATLAB. CRC Press, 2005.