FUNCTION REFERENCE

evaluateGradient

Evaluate the spatial gradient of a 2-D PDE solution at arbitrary query points.

Evaluate the spatial gradient of a 2-D PDE solution at arbitrary query points.

Syntax

[gx, gy] = evaluateGradient(results, xq, yq); [gx, gy] = evaluateGradient(results, xq, yq, iU); [gx, gy] = evaluateGradient(results, xq, yq, iT); [gx, gy] = evaluateGradient(results, xq, yq, iU, iT); [gx, gy] = evaluateGradient(results, querypoints, ...)

Evaluates the finite-element gradient [du/dx, du/dy] of a pde.StationaryResults, pde.TimeDependentResults, or pde.EigenResults object at query coordinates (xq, yq) (or a 2-by-M matrix querypoints) using the mesh's linear (P1) or isoparametric quadratic (P2) shape function derivatives. For pde.StationaryResults the optional 4th argument iU is the equation index. For scalar pde.TimeDependentResults and pde.EigenResults the optional 4th argument iT is the time-step or eigenmode index. For an N-equation time-dependent or eigenvalue result, the 4th argument iU is the equation index and the 5th argument iT is the time-step or eigenmode index. Query points outside the mesh return NaN.

Example

R1=[3;4;0;1;1;0;0;0;1;1]; dl=decsg(R1); m=createpde(); geometryFromEdges(m,dl); generateMesh(m,'Hmax',0.3,'GeometricOrder','linear'); specifyCoefficients(m,'m',0,'d',0,'c',1,'a',0,'f',0); applyBoundaryCondition(m,'dirichlet','Edge',1:4,'u',@(l,s) 2*l.x+3*l.y); res=solvepde(m); [gx, gy] = evaluateGradient(res, 0.5, 0.25); abs(gx - 2) < 1e-12 && abs(gy - 3) < 1e-12

Differences from MATLAB: 2-D meshes only; 3-D tetrahedral meshes are not supported yet.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.