Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)

## Function Synopsis

`y = sph_grady ( z, rx, ry, icos ) ;`

## Help text

``` 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

```

## Cross-Reference Information

This function is called by

```function y = sph_grady ( z, rx, ry, icos ) ;

%---- 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;
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;
```