Home > custom > grid_stats > fastder_rad.m

fastder_rad

PURPOSE ^

calculate slope and aspect (rad) using GRADIENT function

SYNOPSIS ^

function [grad,asp] = fastder_rad(dem,X,Y)

DESCRIPTION ^

 calculate slope and aspect (rad) using GRADIENT function
 USAGE: [grad,asp] = fastder_rad(dem,X,Y)
 Note: 0 is facing North

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [grad,asp] = fastder_rad(dem,X,Y)
0002 % calculate slope and aspect (rad) using GRADIENT function
0003 % USAGE: [grad,asp] = fastder_rad(dem,X,Y)
0004 % Note: 0 is facing North
0005 dx=abs(X(2)-X(1));  % get cell spacing in x and y direction
0006 dy=abs(Y(2)-Y(1));  % from coordinate vectors
0007 [fx,fy] = gradient(dem,dx,dy); % uses simple, unweighted gradient of immediate neighbours
0008 [asp,grad]=cart2pol(fy,fx); % convert to carthesian coordinates
0009 grad=atan(grad); %steepest slope
0010 %asp(asp<pi)=asp(asp<pi)+(pi/2);
0011 %asp(asp<0)=asp(asp<0)+(2*pi);

Generated on Tue 24-Feb-2009 19:14:50 by m2html © 2003