Im trying to solve the Poisson equation in 1D: $$-u_{xx} = f(x), \hspace{6mm} u(a) = d1, \hspace{2mm} u(b) = d2$$Assuming a uniform partition such that $x_n = a + nh$, where $h = (b-a)/N$ and $n \in [0,N]$, and then discretising the problem with linear finite elements to obtain a linear equation system $\mathbf{A u} = \mathbf{f}$. I Want to find the analytical expressions for $\mathbf{A}$ and $\mathbf{f}$.
I found the general expression for $\mathbf{A}$ before incorporating boundary conditions to be $$ \mathbf{A} = \frac{1}{h}\begin{bmatrix} 1 & -1 & 0 & \ldots & \ldots & 0 \\ -1 & 2 & -1 & \ddots & & 0 \\ 0 & -1 & 2 & \ddots & \ddots & 0 \\ \vdots & \ddots & \ddots & \ddots & \ddots & 0 \\ \vdots & & \ddots & -1 & 2 & -1 \\ 0 & \ldots & \ldots & 0 & -1 & 1 \end{bmatrix}$$ and correspondingly for $\mathbf{f}$: $$\mathbf{f} = \big[\frac{1}{2}f(x_0), f(x_1), f(x_2), ... , \frac{1}{2}f(x_{N+1}) \big]^T$$ My trouble is with incorporating the inhomogeneous boundary conditions, I can't find any clear examples of how to do this online despite looking up a ton of sources. Is anyone able to help?