Is there public code in Matlab for solving the Laplace equation in polar coordinates in a circular domain? I tried a lot but my level of Matlab and Mathematica is not good enough, but still not quite understand the scheme.Excuse my English but I'm from Peru.Consider the equation of Laplace$\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{\partial u}{\partial r}\right)+\frac{1}{r^2}\frac{\partial^2u}{\partial\theta^2}=0$with $0\leq r\leq R$ y $0\leq \theta \leq 2\pi$. We will use a mesh $r_i=i\Delta R$ and $\theta_j=j\Delta\theta$. We approximate the equation with the squeme:$\frac{1}{r_i}\left(r_{i+1/2}\frac{u_{i+1j}-u_{ij}}{\Delta r}-r_{j-1/2}\frac{u_{ij}-u_{i-1j}}{\Delta r}\right)\frac{1}{\Delta r}+\frac{1}{r_i^2}\frac{u_{ij+1}-2u_{ij}+u_{ij-1}}{\Delta\theta^2}=0$where $u_{ij}M$ and $f_{ij}$ are mesh functions $(r_i,\theta_j)=(i\Delta r,j\Delta\theta)$. The functions are periodic in the angular index $j$ with period $J=2\pi/\Delta\theta$ and $u_{0j}$ is independent of the value of $j$.To derive the condition of the source Laplace equation integrate on the disk $D$ with radius $\varepsilon$, obtaining$\int\int_D frdrd\theta=\int\int_D\frac{1}{r}\left[\frac{\partial}{\partial r}\left(r\frac{\partial u}{\partial r}\right)\right] + \frac{1}{r^2}\frac{\partial^2u}{\partial\theta^2}rdrd\theta$$\int_0^2\pi \frac{\partial u}{\partial r}\varepsilon d\theta$Now, choosing $\varepsilon$ = $\Delta j/2$ and approximating this relation by$f(0)\left(\frac{\Delta r}{2}\right)^2\pi=\sum\frac{u_{1j}-u_0}{\Delta r}\frac{\Delta r}{2}\Delta\theta$$u_{0j}$ is independent $j$, let's call $u_0$ we have$u_0=\frac{1}{J}\sum u_{ij}-f(0)\left(\frac{\Delta r}{2}\right)^2$as $f(0)=0$then$u_0=\frac{1}{J}\sum u_{ij}$
Laplace's equation problem in Polar Coordinates (Edit)
pde;finite difference;matlab;mathematica