# Pde problem with robin boundary condition

I have my pde 2D problem with robin condition (form: du/dn +ku=g) to solve with matlab. i have the exact function u and I want to find the function g in robin condition. How can i do it? thanks for the help :)

• As you can see with the benefit of the Answer below, there is missing information needed to explain the normal derivative, namely what shape is the boundary? The normal derivative is the directional derivative of u with respect to an outward facing unit vector perpendicular to the curve defining the boundary of your domain. – hardmath Dec 28 '13 at 14:50

You can compute $\nabla u$ and the outward normal $n$ to get $\frac{\partial u}{\partial n}$. Add that and $\kappa u$ on the Robin boundary and get $g$. Is that what you're looking for?
• @Betelgeuse: the normal vector is simply a vector $\mathbf b=\mathbf n(\mathbf x)$ that at every point $\mathbf x$ of the boundary points perpendicular to the boundary, outward of the domain, with length one. For example, if your domain is a box, $\mathbf n$ is either $(\pm 1, 0)^T$ or $(0, \pm 1)^T$, depending on which of the four parts of the domain you're on. The normal derivative $\partial u/\partial n=\mathbf n \cdot \nabla u$ is then just the dot product of the gradient and this normal vector. – Wolfgang Bangerth Dec 15 '13 at 8:12
• Of course, $\mathbf b$ in the first line should have been $\mathbf n$. – Wolfgang Bangerth Dec 15 '13 at 12:48