# One-dimensional Shape Functions

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Shape Functions for 1D problems

If a polynomial is selected as basis function, then: $\frac{}{} N_i(x) = a_1 + a_2 x + a_3 x^2 + ...$ $N_i(x_j) = \begin{cases} 1, & i=j \\ 0, & i \ne j \end{cases}$

## Linear case

Two nodes: $\frac{}{} x_1, x_2$ $\frac{}{} N_i(x) = a_{i1} + a_{i2} x$ \left . \left . \begin{align} N_1(x_1) & = 1 \\ N_1(x_2) & = 0 \\ \tfrac{}{} \\ N_2(x_1) & = 0 \\ N_2(x_2) & = 1 \end{align} \right \} \Rightarrow \begin{align} \tfrac{}{} a_{11} + a_{12} x1 & = 1 \\ \tfrac{}{} a_{11} + a_{12} x2 & = 0 \\ \tfrac{}{} \\ \tfrac{}{} a_{21} + a_{22} x1 & = 0 \\ \tfrac{}{} a_{21} + a_{22} x2 & = 1 \end{align} \right \} \Rightarrow \begin{align} \begin{bmatrix} 1 & x_1 \\ 1 & x_2 \end{bmatrix} \begin{bmatrix} a_{11} \\ a_{12} \end{bmatrix} & = \begin{bmatrix} 1 \\ 0 \end{bmatrix} \\ \tfrac{}{} \\ \begin{bmatrix} 1 & x_1 \\ 1 & x_2 \end{bmatrix} \begin{bmatrix} a_{21} \\ a_{22} \end{bmatrix} & = \begin{bmatrix} 0 \\ 1 \end{bmatrix} \end{align} \left . \begin{align} \tfrac{}{} a_{11} & = x_2 \\ \tfrac{}{} a_{12} & = -1 \\ \tfrac{}{} \\ \tfrac{}{} a_{21} & = - x_1 \\ \tfrac{}{} a_{22} & = 1 \end{align} \right \} \Rightarrow \begin{align} N_1(x) & = \frac{x_2-x}{\Delta} = \frac{x_2-x}{x_2-x_1} \\ N_2(x) & = \frac{-x_1+x}{\Delta} = \frac{x-x_1}{x_2-x_1} \end{align}

with: $\frac{}{} \Delta = x_2 - x_1 = l^{(e)}$ the determinant of the matrix. Three nodes: $\frac{}{} x_1, x_2, x_3$ $\frac{}{} N_i(x) = a_{i1} + a_{i2} x + a_{i3} x^2$ \left . \left . \begin{align} N_1(x_1) & = 1 \\ N_1(x_2) & = 0 \\ N_1(x_3) & = 0 \\ \tfrac{}{} \\ N_2(x_1) & = 0 \\ N_2(x_2) & = 1 \\ N_2(x_3) & = 0 \\ \tfrac{}{} \\ N_3(x_1) & = 0 \\ N_3(x_2) & = 0 \\ N_3(x_3) & = 1 \end{align} \right \} \Rightarrow \begin{align} \tfrac{}{} a_{11} + a_{12} x_1 + a_{13} x_1^2 & = 1 \\ \tfrac{}{} a_{11} + a_{12} x_2 + a_{13} x_2^2 & = 0 \\ \tfrac{}{} a_{11} + a_{12} x_3 + a_{13} x_3^3 & = 0 \\ \tfrac{}{} \\ \tfrac{}{} a_{21} + a_{22} x_1 + a_{23} x_1^2 & = 0 \\ \tfrac{}{} a_{21} + a_{22} x_2 + a_{23} x_2^2 & = 1 \\ \tfrac{}{} a_{21} + a_{22} x_3 + a_{23} x_3^2 & = 0 \\ \tfrac{}{} \\ \tfrac{}{} a_{31} + a_{32} x_1 + a_{33} x_1^2 & = 0 \\ \tfrac{}{} a_{31} + a_{32} x_2 + a_{33} x_2^2 & = 0 \\ \tfrac{}{} a_{31} + a_{32} x_3 + a_{33} x_3^2 & = 1 \end{align} \right \} \Rightarrow \begin{align} \begin{bmatrix} 1 & x_1 & x_1^2 \\ 1 & x_2 & x_2^2 \\ 1 & x_3 & x_3^2 \\ \end{bmatrix} \begin{bmatrix} a_{11} \\ a_{12} \\ a_{13} \end{bmatrix} & = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} \\ \tfrac{}{} \\ \begin{bmatrix} 1 & x_1 & x_1^2 \\ 1 & x_2 & x_2^2 \\ 1 & x_3 & x_3^2 \end{bmatrix} \begin{bmatrix} a_{21} \\ a_{22} \\ a_{23} \end{bmatrix} & = \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} \\ \tfrac{}{} \\ \begin{bmatrix} 1 & x_1 & x_1^2 \\ 1 & x_2 & x_2^2 \\ 1 & x_3 & x_3^2 \end{bmatrix} \begin{bmatrix} a_{31} \\ a_{32} \\ a_{33} \end{bmatrix} & = \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix} \end{align} $\frac{}{} \Delta = (x_2 x_3^2 - x_3 x_2^2) - (x_1 x_3^2 - x_3 x_1^2) + (x_1 x_2^2 - x_2 x_1^2)$ $\begin{matrix} \tfrac{}{} a_{11} = & x_2 x_3^2 - x_3 x_2^2 & \tfrac{}{} a_{21} = & - (x_1 x_3^2 - x_3 x_1^2) & \tfrac{}{} a_{31} = & (x_1 x_2^2 - x_2 x_1^2) \\ \tfrac{}{} a_{12} = & -(x_3^2-x_2^2) & \tfrac{}{} a_{22} = & (x_3^2-x_1^2) & \tfrac{}{} a_{32} = & -(x_2^2-x_1^2) \\ \tfrac{}{} a_{13} = & x_3-x_2 & \tfrac{}{} a_{23} = & -(x_3-x_1) & \tfrac{}{} a_{33} = & (x_2-x_1) \end{matrix}$ ## Cubic case

Four nodes: $\frac{}{} x_1, x_2, x_3, x_4$ $\frac{}{} N_i(x) = a_{i1} + a_{i2} x + a_{i3} x^2 + a_{i4} x^3$ \left . \left . \begin{align} N_1(x_1) & = 1 \\ N_1(x_2) & = 0 \\ N_1(x_3) & = 0 \\ N_1(x_4) & = 0 \\ \tfrac{}{} \\ N_2(x_1) & = 0 \\ N_2(x_2) & = 1 \\ N_2(x_3) & = 0 \\ N_2(x_4) & = 0 \\ \tfrac{}{} \\ N_3(x_1) & = 0 \\ N_3(x_2) & = 0 \\ N_3(x_3) & = 1 \\ N_3(x_4) & = 0 \\ \tfrac{}{} \\ N_4(x_1) & = 0 \\ N_4(x_2) & = 0 \\ N_4(x_3) & = 0 \\ N_4(x_4) & = 1 \\ \end{align} \right \} \Rightarrow \begin{align} \tfrac{}{} a_{11} + a_{12} x_1 + a_{13} x_1^2 + a_{14} x_1^3 & = 1 \\ \tfrac{}{} a_{11} + a_{12} x_2 + a_{13} x_2^2 + a_{14} x_2^3 & = 0 \\ \tfrac{}{} a_{11} + a_{12} x_3 + a_{13} x_3^3 + a_{14} x_3^3 & = 0 \\ \tfrac{}{} a_{11} + a_{12} x_4 + a_{13} x_4^3 + a_{14} x_4^3 & = 0 \\ \tfrac{}{} \\ \tfrac{}{} a_{21} + a_{22} x_1 + a_{23} x_1^2 + a_{24} x_1^3 & = 0 \\ \tfrac{}{} a_{21} + a_{22} x_2 + a_{23} x_2^2 + a_{24} x_2^3 & = 1 \\ \tfrac{}{} a_{21} + a_{22} x_3 + a_{23} x_3^2 + a_{24} x_3^3 & = 0 \\ \tfrac{}{} a_{21} + a_{22} x_4 + a_{23} x_4^2 + a_{24} x_4^3 & = 0 \\ \tfrac{}{} \\ \tfrac{}{} a_{31} + a_{32} x_1 + a_{33} x_1^2 + a_{34} x_1^3 & = 0 \\ \tfrac{}{} a_{31} + a_{32} x_2 + a_{33} x_2^2 + a_{34} x_2^3 & = 0 \\ \tfrac{}{} a_{31} + a_{32} x_3 + a_{33} x_3^2 + a_{34} x_3^3 & = 1 \\ \tfrac{}{} a_{31} + a_{32} x_4 + a_{33} x_4^2 + a_{34} x_4^3 & = 0 \\ \tfrac{}{} \\ \tfrac{}{} a_{41} + a_{42} x_1 + a_{43} x_1^2 + a_{44} x_1^3 & = 0 \\ \tfrac{}{} a_{41} + a_{42} x_2 + a_{43} x_2^2 + a_{44} x_2^3 & = 0 \\ \tfrac{}{} a_{41} + a_{42} x_3 + a_{43} x_3^2 + a_{44} x_3^3 & = 0 \\ \tfrac{}{} a_{41} + a_{42} x_4 + a_{43} x_4^2 + a_{44} x_4^3 & = 1 \end{align} \right \} \Rightarrow \begin{align} \begin{bmatrix} 1 & x_1 & x_1^2 & x_1^3 \\ 1 & x_2 & x_2^2 & x_2^3 \\ 1 & x_3 & x_3^2 & x_3^3 \\ 1 & x_4 & x_4^2 & x_4^3 \end{bmatrix} \begin{bmatrix} a_{11} \\ a_{12} \\ a_{13} \\ a_{14} \end{bmatrix} & = \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} \\ \tfrac{}{} \\ \begin{bmatrix} 1 & x_1 & x_1^2 + x_1^3 \\ 1 & x_2 & x_2^2 + x_2^3 \\ 1 & x_3 & x_3^2 + x_3^3 \\ 1 & x_4 & x_4^2 + x_4^3 \end{bmatrix} \begin{bmatrix} a_{21} \\ a_{22} \\ a_{23} \\ a_{24} \end{bmatrix} & = \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix} \\ \tfrac{}{} \\ \begin{bmatrix} 1 & x_1 & x_1^2 & x_1^3 \\ 1 & x_2 & x_2^2 & x_2^3 \\ 1 & x_3 & x_3^2 & x_3^3 \\ 1 & x_4 & x_4^2 & x_4^3 \end{bmatrix} \begin{bmatrix} a_{31} \\ a_{32} \\ a_{33} \\ a_{34} \end{bmatrix} & = \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix} \\ \tfrac{}{} \\ \begin{bmatrix} 1 & x_1 & x_1^2 & x_1^3 \\ 1 & x_2 & x_2^2 & x_2^3 \\ 1 & x_3 & x_3^2 & x_3^3 \\ 1 & x_4 & x_4^2 & x_4^3 \end{bmatrix} \begin{bmatrix} a_{41} \\ a_{42} \\ a_{43} \\ a_{44} \end{bmatrix} & = \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix} \end{align} $\begin{matrix} \frac{}{} \Delta = & x_2(x_3^2 x_4^3 - x_3^3 x_4^2) - x_3 (x_2^2 x_4^3 - x_2^3 x_4^2) + x_4 (x_2^2 x_3^3 - x_2^3 x_3^2) \\ - & (x_1 (x_3^2 x_4^3 - x_3^3 x_4^2) - x_3 (x_1^2 x_4^3 - x_1^3 x_4^2) + x_4 (x_1^2 x_3^3-x_1^3 x_3^2)) \\ + & (x_1 (x_2^2 x_4^3 - x_2^3 x_4^2) - x_2 (x_1^2 x_4^3 - x_1^3 x_4^2) + x_4 (x_1^2 x_2^3-x_1^3 x_2^2)) \\ - & (x_1 (x_2^2 x_3^3 - x_2^3 x_3^2) - x_2 (x_1^2 x_3^3 - x_1^3 x_3^2) + x_3 (x_1^2 x_2^3-x_1^3 x_2^2)) \end{matrix}$ $a_{11}= \frac{1}{\Delta} \begin{bmatrix} x_2 & x_2^2 & x_2^3 \\ x_3 & x_3^2 & x_3^3 \\ x_4 & x_4^2 & x_4^3 \end{bmatrix} = \frac{x_2(x_3^2 x_4^3 - x_3^3 x_4^2) - x_3 (x_2^2 x_4^3 - x_2^3 x_4^2) + x_4 (x_2^2 x_3^3 - x_2^3 x_3^2) }{\Delta}$ $a_{12} = - \frac{1}{\Delta} \begin{bmatrix} 1 & x_2^2 & x_2^3 \\ 1 & x_3^2 & x_3^3 \\ 1 & x_4^2 & x_4^3 \end{bmatrix} = -\frac{((x_3^2 x_4^3 - x_3^3 x_4^2) - (x_2^2 x_4^3 - x_2^3 x_4^2) + (x_2^2 x_3^3 - x_2^3 x_3^2)) }{\Delta}$ $a_{13} = \frac{1}{\Delta} \begin{bmatrix} 1 & x_2 & x_2^3 \\ 1 & x_3 & x_3^3 \\ 1 & x_4 & x_4^3 \end{bmatrix} = \frac{((x_3 x_4^3 - x_3^3 x_4) - (x_2 x_4^3 - x_2^3 x_4) + (x_2 x_3^3 - x_2^3 x_3)) }{\Delta}$ $a_{14} = - \frac{1}{\Delta} \begin{bmatrix} 1 & x_2 & x_2^2 \\ 1 & x_3 & x_3^2 \\ 1 & x_4 & x_4^2 \end{bmatrix} = -\frac{((x_3 x_4^2 - x_3^2 x_4) - (x_2 x_4^2 - x_2^2 x_4) + (x_2 x_3^2 - x_2^2 x_3)) }{\Delta}$

and so on... (note that the expressions for the N2, N3 and N4 can be easily obtained by swapping the x2 values for the x1 values in the first case, x3 for x1 in the second case and x4 for x1 in the last one. To check by yourself the functions, use this Matlab code

## Lagrangian elements

To avoid solving this so complex system of equations, the well-known properties of the Lagragian polynomials can be used.
All these shape functions are based in the polynomial Lagrange and can be written as follows: $N_i^{(e)}(x)=\frac{(x - x_1)(x - x_2)... (x - x_{i-1})(x - x_{i+1})...(x - x_n)}{(x_i - x_1)(x_i - x_2)... (x_i - x_{i-1})(x_i - x_{i+1})...(x_i - x_n)}$ $N_i^{(e)}(x) = \prod_{j=1 (j \ne i)}^n \frac{x - x_j}{x_i - x_j}$

This equation is easier to implement, as can be checked using this Matlab code.
An example of using nine nodes for each element, for which the expressions are unwriteable is shown. ## Normalised Shape Functions

All these expressions can be normalised using the natural coordinate system, based in $\frac{}{} \xi$, a variable defined in terms of $\frac{}{} x_c$, the central coordinate of the element, as follows: $\xi = 2 \frac{x - x_c}{l^{(e)}}$

Note that $\frac{}{} \xi = -1$ in the left node, $\frac{}{} \xi = 0$ in the central point of the element, and $\frac{}{} \xi = 1$ in the right node of the element.

In this way, all the shape functions can be expressed and, therefore obtained, independently of the real geometry, and then easier to implement. $N_i^{(e)}(\xi) = \prod_{j=1 (j \ne i)}^n \left( \frac{\xi - \xi_j}{\xi_i - \xi_j} \right)$

For the Linear case, this transformation can be illustrated:  The final specific expressions for the 1D Linear element are: $N_1^{(e)}(\xi) = \frac {\xi - \xi_2}{\xi_1 - \xi_2} = \frac{1}{2} (1 - \xi)$ $N_2^{(e)}(\xi) = \frac {\xi - \xi_1}{\xi_2 - \xi_1} = \frac{1}{2} (1 + \xi)$ $N_1^{(e)}(\xi) = \frac {(\xi - \xi_2)(\xi - \xi_3)}{(\xi_1 - \xi_2)(\xi_1 - \xi_3)} = \frac{1}{2} \xi (1 - \xi)$ $N_2^{(e)}(\xi) = \frac {(\xi - \xi_1)(\xi - \xi_3)}{(\xi_2 - \xi_1)(\xi_2 - \xi_3)} = (1 + \xi)(1 - \xi)$ $N_3^{(e)}(\xi) = \frac {(\xi - \xi_1)(\xi - \xi_2)}{(\xi_3 - \xi_1)(\xi_3 - \xi_2)} = \frac{1}{2} \xi (1 + \xi)$

Finally, for 1D cubic elements the normalised shape functions are: $N_1^{(e)}(\xi) = \frac {(\xi - \xi_2)(\xi - \xi_3)(\xi - \xi_4)}{(\xi_1 - \xi_2)(\xi_1 - \xi_3)(\xi_1 - \xi_4)} = - \frac{9}{16} (\xi + \frac{1}{3})(\xi - \frac{1}{3})(\xi - 1)$ $N_2^{(e)}(\xi) = \frac {(\xi - \xi_1)(\xi - \xi_3)(\xi - \xi_4)}{(\xi_2 - \xi_1)(\xi_2 - \xi_3)(\xi_2 - \xi_4)} = \frac{27}{16} (\xi + 1)(\xi - \frac{1}{3})(\xi - 1)$ $N_3^{(e)}(\xi) = \frac {(\xi - \xi_1)(\xi - \xi_2)(\xi - \xi_4)}{(\xi_3 - \xi_1)(\xi_3 - \xi_2)(\xi_3 - \xi_4)} = - \frac{27}{16} (\xi + 1)(\xi + \frac{1}{3})(\xi - 1)$ $N_4^{(e)}(\xi) = \frac {(\xi - \xi_1)(\xi - \xi_2)(\xi - \xi_3)}{(\xi_4 - \xi_1)(\xi_4 - \xi_2)(\xi_4 - \xi_3)} = \frac{9}{16} (\xi + 1)(\xi + \frac{1}{3})(\xi - \frac{1}{3})$

Back to the Shape Functions section