# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

This page describes the legacy workflow. New features might not be compatible with the legacy workflow. For the corresponding step in the recommended workflow, see `evaluateGradient`.

## Syntax

```[ux,uy] = pdegrad(p,t,u)
```

## Description

`[ux,uy] = pdegrad(p,t,u)` returns the gradient of `u` evaluated at the center of each triangle.

Row i from 1 to N of `ux` contains

`$\frac{\partial {u}_{i}}{\partial x}$`

Row i from 1 to N of `uy` contains

`$\frac{\partial {u}_{i}}{\partial y}$`

There is one column for each triangle in `t` in both `ux` and `uy`.

Although `pdegrad` returns the value of the gradient at the center of a triangle, the gradient is actually the same everywhere in the triangle interior. This is because `pdegrad` uses only linear basis functions. The boundaries of triangles are a special case: here the derivatives might be discontinuous.

The geometry of the PDE problem is given by the mesh data `p` and `t`. For details on the mesh data representation, see `initmesh`.

The optional argument `sdl` restricts the computation to the subdomains in the list `sdl`.