function z = calculateEllipk4(st,sc)
%
% NO ANGLE!
% 
%function [abstand,ang] = ellipk4(st,sc)
%
%     routine computes great arc distance  z in kilometers on a spheroid
%     with flattening =1/295=.00339 using the andoyer-lambert approximation.
%     z is the distance from sc to st and ang is the bearing from sc to 
%     st in true radians rel. to north. 
%     the coordinates for sc and st(lat,long) must be in radians. this and
%     other details make this routine different from an earlier version 
%     ellips used at yale.
%     6377. is the equatorial radius of the earth minus the depth of the
%     sound channel(=1200meters).
%     6378 is the equatorial radius of the earth, approximately.
%
%     changed to matlab by c.schmid march 94
% 

snst=sin(st(:,1));
snsc=sin(sc(:,1));
cfz = snst * snsc + cos(st(:,1)) * cos(sc(:,1)) * cos(st(:,2)-sc(:,2));
z = 1 - cfz * cfz;
sfz=sqrt(z);
z=atan2(sfz,cfz);
a=snst-snsc;
b=snst+snsc;
delz = (z+3*sfz) / (1.-cfz) *a *a;
delz =  .84752e-3 * (delz + (z-3.*sfz) / (1.+cfz) *b *b);
z=6378.0*(z-delz);
%the end
