[Math] Laplace equation in 1D with MATLAB – Neumann boundary condition

boundary value problemMATLABordinary differential equationspartial differential equations

My previous problem is here and I 've done. Laplace equation in 1D with MATLAB – Dirichlet boundary condition

I have the next problem: solve Laplace equation in $1$D with boundary condition $u'(0)=u'(1)=0$

Help me some hints.

Thanks in advanced.

Best Answer

I saw your code there. Just use it, and replace the boundary conditions with the following: $$ u'(0)\approx\frac{u_1-u_0}{\Delta x}, $$ $$ u'(1)\approx\frac{u_M-u_{M-1}}{\Delta x}, $$ where $u_j$ is your numerical solution.

Thus you have: $$ u_0=u_1-u'(0)\Delta x, $$ $$ u_M=u_{M-1}+u'(0)\Delta x. $$

This is a first order approximation. Expand further the Taylor series (using more grid points) to enhance the approximation goodness.

In your specific case: $$ u_0=u_1, $$ $$ u_M=u_{M-1}. $$

Related Question