Global Index (short | long) | Local contents | Local Index (short | long)
y = sph_grady ( z, rx, ry, icos ) ;
function y = sph_grady ( z, rx, ry, icos ) ; rx and ry must be specified in radian; if icos = TRUE; use operator : 1/cos d/dy cos else use operator : d/dy SEE : sph_grad, sph_div, sph_curl
This function is called by | |
---|---|
function y = sph_grady ( z, rx, ry, icos ) ; global RADUS RADIAN DEGREE %---- check and reshape input if necessary [zy,zx] = size(z); nx = length(rx); ny = length(ry); if ( zx ~= nx ); z = reshape ( z, nx, ny )'; end; %---- calculations iy2=[2:ny ny]; iy1=[1 1:(ny-1)]; ady = RADUS * ( ry(iy2) - ry(iy1) )' * ones(size(rx)) ; if icos % operate as ' 1/cos d/dy cos ' cosy = cos( ry' ) * ones(size(rx)) ; z = cosy .* z; acosdy = cosy .* ady; y = ( z(iy2,:) - z(iy1,:) ) ./ acosdy; % check end points to ensure polar values are reasonable if cos(ry( 1))<1e-5; y( 1,:) = mean(y( 2,:)) * ones(1,nx); end if cos(ry(ny))<1e-5; y(ny,:) = mean(y(ny-1,:)) * ones(1,nx); end else % operate as ' d/dy ' y = ( z(iy2,:) - z(iy1,:) ) ./ ady; end %---- reshape output if necessary if ( zx ~= nx ); y = reshape ( y', zy, zx ); end;