clear all;
close all;
fclose all;
%mex -f c:\matlab\bin\msvcengmatopts.bat pvzvxvy2.c
%mex -O pvzvxvy1.c
wrkdir='d:\1cva\movsrcpv\';
%wrkdir='\\gw\d\1cva\movsrcpv\';
%
path=str2mat(wrkdir,'wr');zbg=0.1;zfn=0.1;tracename='100m\';
%path=str2mat(wrkdir,'vr');zbg=0.005;zfn=0.005;tracename='5m\'; %5m vr
nfr=256;
ifrlo=31; % --lower pole sets are suspected to be incorrect in norm;
ifrhi=255;
ifrndx=255;
cgrmx=1.6;
xbg=0.01;xfn=5.0;

trcpvzr(path,tracename,nfr,ifrlo,ifrhi,ifrndx,cgrmx,xbg,zbg,xfn,zfn); return

galsleng=2.0;
vsrc=9.0;
flnm=[deblank(path(1,:)) tracename 'trcfir.mat'];
load(flnm);
srcsig=randn(1,fix(galsleng/1.852/vsrc*3600*168.3));
%
xini=0.2; yini=-1.0; hdg= 90.0; signame='sig1.mat';
%xini=0.2; yini= 1.0; hdg=270.0; signame='sig2.mat';
%xini=(1.0+0.2)/sqrt(2.0); yini=-(1.0-0.2)/sqrt(2.0); hdg=135.0; signame='sig11.mat';
%xini=-(1.0-0.2)/sqrt(2.0); yini=(1.0+0.2)/sqrt(2.0); hdg=315.0; signame='sig12.mat';
%xini=0.4; yini=-1.0; hdg= 90.0; signame='sig3.mat';
%xini=0.4; yini= 1.0; hdg=270.0; signame='sig4.mat';
%xini=(1.0+0.4)/sqrt(2.0); yini=-(1.0-0.4)/sqrt(2.0); hdg=135.0; signame='sig13.mat';
%xini=-(1.0-0.4)/sqrt(2.0); yini=(1.0+0.4)/sqrt(2.0); hdg=315.0; signame='sig14.mat';
rpp=[xini yini vsrc hdg];
%save('5m\trcfir2.mat','np','rp','xr','pr','vz','vx','srcsig','rpp');
%!pvzvxvy2 5m\trcfir2.mat
[ps,vzs,vxs,vys]=pvzvxvy1(np,rp,xr,pr,vz,vx,srcsig,rpp);
flnms=[deblank(path(1,:)) tracename signame];
save(flnms,'ps','vzs','vxs','vys');
