


calculate slope (deg) using GRADIENT function


0001 function grad = fastslope(dem,X,Y) 0002 % calculate slope (deg) using GRADIENT function 0003 dx=abs(X(2)-X(1)); % get cell spacing in x and y direction 0004 dy=abs(Y(2)-Y(1)); % from coordinate vectors 0005 [fx,fy] = gradient(dem,dx,dy); % uses simple, unweighted gradient of immediate neighbours 0006 [asp,grad]=cart2pol(fy,fx); % convert to carthesian coordinates 0007 grad=atand(grad); %steepest slope