function trm=velz(ffreqs,dirs,wns,z,depth,xpos,ypos)

%Edits were made on 4/20/10 to fix a bug in the cutoff limits in the KZ
%parts of the transfer function. 

%set the cutoff value (for high frequencies)
cutoff=0.1;


KZ=sinh(z*wns)./sinh(depth*wns);
FLKZ=ffreqs.*KZ;

%find the cutoff and replace the values below it
cutindex=find(FLKZ < cutoff);
FLKZ(cutindex)=cutoff;


trm=-1i*(FLKZ)*ones(size(dirs));