[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
- else /tools/hpmatlab/toolbox/matlab/lang/else.m
- end /tools/hpmatlab/toolbox/matlab/lang/end.m
- for /tools/hpmatlab/toolbox/matlab/lang/for.m
- i /tools/hpmatlab/toolbox/matlab/elmat/i.m
- if /tools/hpmatlab/toolbox/matlab/lang/if.m
- imag /tools/hpmatlab/toolbox/matlab/elfun/imag.m
- j /tools/hpmatlab/toolbox/matlab/elmat/j.m
- length /tools/hpmatlab/toolbox/matlab/general/length.m
- nargin /tools/hpmatlab/toolbox/matlab/elmat/nargin.m
- nargout /tools/hpmatlab/toolbox/matlab/elmat/nargout.m
- ones /tools/hpmatlab/toolbox/matlab/elmat/ones.m
- real /tools/hpmatlab/toolbox/matlab/elfun/real.m
- size /tools/hpmatlab/toolbox/matlab/general/size.m
- sqrt /tools/hpmatlab/toolbox/matlab/elfun/sqrt.m
- zeros /tools/hpmatlab/toolbox/matlab/elmat/zeros.m
Produced by mat2html on Wed Feb 8 12:25:18 EST 1995
Cross-Directory links are: ON