% model.m defines model parameters
cc(1)=5000; dd(1)=500  ; % velocity (ft/s), depth (ft) of 1st layer interface;
cc(2)=7000; dd(2)=1000 ; % velocity (ft/s), depth (ft) of 2nd layer interface;
cc(3)=5000; dd(3)=1500 ; % velocity (ft/s), depth (ft) of 3rd layer interface;
cc(4)=7000; dd(4)=2000 ; % velocity (ft/s), depth (ft) of 4th layer interface;

nlay=length(cc);
cmax=max(cc);cmin=min(cc);
dx=cmin/(fre*35);nx=round(dd(nlay)/dx);dt=.99*dx/cmax; % Estimate dt and dx for stability+accuracy
nt=round(ttotal/dt);alpha=(dt/dx)^2;

ricker=zeros(1,nt);p0=zeros(1,nx);
p1=p0;p2=p0;seismo=zeros(nt,ntrace);
nlay=length(cc);is=1; c22=ones(1,nx)*cc(nlay);
for n=1:nlay;ie=round(dd(n)/dx);
for i=is:ie;  c22(i)=cc(n);end;
is=ie;end; c22=c22.*c22; nx1=nx-1;nx2=nx-2;
%
cc(nlay+1)=cc(nlay);
for i=1:nlay;
yyy(2*i) = .2*cc(i)/max(cc);
yyy(2*i+1) = .2*cc(i+1)/max(cc);
xxx(2*i)=dd(i);
xxx(2*i+1)=dd(i);
end;
xxx(1)=0;yyy(1)=.2*cc(1)/max(cc);