[Master Index] [Index for /tools/hpmatlab/toolbox/matlab/datafun]

gradient

(/tools/hpmatlab/toolbox/matlab/datafun/gradient.m)


Function Synopsis

[xx,yy] = grad(a,xax,yax)

Help text

GRADIENT Approximate gradient.
	[PX,PY] = GRADIENT(Z,DX,DY) returns the numerical partial derivatives
	of matrix Z in matrices PX = dZ/dx and PY = dZ/dy.   DX and DY
	may be scalars containing the sample spacing in the X and Y
	directions, or they may be vectors containing all the explicit
	locations.

	[PX,PY] = GRADIENT(Z) assumes DX = DY = 1.

	If Y is a vector, GRADIENT(Y) and GRADIENT(Y,DX) return the one
	dimensional numerical derivative dY/dX.

	For example, try
	   [x,y] = meshgrid(-2:.2:2, -2:.2:2);
	   z = x .* exp(-x.^2 - y.^2);
	   [px,py] = gradient(z,.2,.2);
	   contour(z),hold on, quiver(px,py), hold off

	See also DIFF, DEL2, QUIVER, CONTOUR.

Cross-Reference Information

This function calls

Produced by mat2html on Wed Feb 8 12:25:18 EST 1995
Cross-Directory links are: ON