Program Matlab
Program Matlab
PROGRAM MATLAB
% define model h = [0.2 0.2 0.3]; vp = [1.5 2 2.5 3.0]; vs = [0.75 1.0 1.25 1.5]; D = [0.05:0.05:2]; % hitung travel-time (P-reflected) [pr,tr] = raytr(h,vp,D); plot(D,tr,'k'); axis ij; % hitung gelombang langsung P tdp = D/vp(1); hold on; plot(D,tdp,'r'); %hold off; % hitung gelombang GR tgr = 2.*D/(0.9*vp(1)); plot(D,tgr,'b'); %hold off; % hitung headwave lapis 1 thcrit = asin(vp(1)/vp(2)); xcrit = 2*h(1)*tan(thcrit); ihw = find(D>=xcrit); DHW = D(ihw); thw = DHW/vp(2)+2*h(1)*sqrt(vp(2)^2-vp(1)^2)/ ... (vp(1)*vp(2)); plot(DHW,thw,'m'); %hold off; % hitung P-S wave [pps,tps] = raytrps(h,vp,vs,D); plot(D,tps,'r'); %hold off % hitung multipel : 1 2 2 2 2 1 imult = [1 2 2 2 2 1]; [pm,tm] = raytrmul(h,vp,D,imult); plot(D,tm,'g'); hold off
dx(i,k)=(p(k)*vel(i).*dz(i))/sqrt(1-p(k)*p(k).*vel(i).*vel(i)); %menghitung jarak lateral di setiap lapisan dt(i,k)=dz(i)/(vel(i).*sqrt(1-p(k)*p(k).*vel(i).*vel(i))); %menghitung waktu tempuh di setiap lapisan end end for k=1:norays twt(k)=2*sum(dt(:,k)); %menghitung twt untuk masing-masing sinar end %%%memanipulasi offset dx_down=dx; dx_up=flipud(dx_down); dx=[dx_down;dx_up]; dx(1,1)=dx(1,1); for k=1:norays for i=2:nolayers*2, dx(i,k)=dx(i-1,k)+dx(i,k); end end nol=[1:norays]*0; dx=[nol;dx]; %%memanipukasi kedalaman dz=dz(1:nolayers); dz(1)=dz(1); for i=2:nolayers, dz(i)=dz(i-1)+dz(i); end dz_down=dz'; dz_up=flipud(dz_down); dz_up=dz_up(2:nolayers); dz=[0;dz_down;dz_up;0]; offset=dx(nolayers*2+1,:); % plot hasil for k=1:norays subplot(1,2,1) plot(dx(:,k),dz); hold on end xlabel('offset(m)') ylabel('depth(m)') title('Jejak Sinar') state=set(gca,'ydir'); if (strcmp(state,'reverse')) set(gca,'ydir','reverse') else set(gca,'ydir','reverse') end a=size(dx); dx=reshape(dx,a(1,1)*a(1,2),1);
x = [0 max(dx)]; for i=1:nolayers y = [dz(i) dz(i)]; plot(x,y,'r'); hold on end axis([0 max(dx) 0 max(dz)]); subplot(1,2,2) plot(offset,twt,'linewidth',3); grid on; hold on xlabel('offset(m)') ylabel('twt(s)') title('Kurva Waktu Tempuh') state=set(gca,'ydir'); if (strcmp(state,'reverse')) set(gca,'ydir','reverse') else set(gca,'ydir','reverse') end clear end
s=s(51:length(t)+50); s=s/max(s); figure end if(nargin<7) resampfact=1; end if(nargin<6) dir=1; end if(nargin<5) polarity=1; end if(nargin<4) ilive=find(~isnan(s)); snot=mean(s(ilive)); end if(nargin<3) kolor='g'; end if(abs(polarity)~=1) error('invalid polarity value'); end test=sum(abs(s-snot)); if(test>1000*eps) dt=t(2)-t(1); ss=polarity*[snot;s(:);snot]; n=length(ss); tt=[t(1)-dt;t(:);t(length(t))+dt]; il=find(ss<=snot); ilow=[0;il;n+1]; ind=diff(ilow); ibdy=find(ind>1); ind=find(diff(ibdy)==1); ising=ilow(ibdy(ind)+1); if(~isempty(ising)) if(ising(1)==0) ising(1)=[]; end if(ising(length(ising))==n+1) ising(length(ising))=[]; end if(~isempty(ising)) for k=1:length(ising) ss=[ss(1:ising(k));ss(ising(k));ss(ising(k)+1:length(ss))]; tt=[tt(1:ising(k));tt(ising(k));tt(ising(k)+1:length(tt))]; ising=ising+1; end end il=find(ss<=snot); ilow=[0;il;n+1]; ind=diff(ilow);
ibdy=find(ind>1); end ibdy1=ilow(ibdy); ibdy2=ilow(ibdy+1); if(ibdy1(1)==0) ibdy1(1)=[]; end if(ibdy1(length(ibdy1))==n+1) ibdy1(length(ibdy1))=[]; end if(ibdy2(1)==0) ibdy2(1)=[]; end if(ibdy2(length(ibdy2))==n+1) ibdy2(length(ibdy2))=[]; end tnot=(snot-ss(ibdy1))./(ss(ibdy1+1)-ss(ibdy1)); tnot=tnot.*(tt(ibdy1+1)-tt(ibdy1))+tt(ibdy1); tt(ibdy1)=tnot; tnot=(snot-ss(ibdy2))./(ss(ibdy2-1)-ss(ibdy2)); tnot=tnot.*(tt(ibdy2-1)-tt(ibdy2))+tt(ibdy2); tt(ibdy2)=tnot; ss(il)=snot*ones(size(il)); ss=[snot;ss(2:length(ss)-1);snot]; tt=[t(1);tt(2:length(tt)-1);t(length(t))]; else ss=s; tt=t; end if(dir==1) hva=patch('xdata',polarity*ss,'ydata',tt,... 'edgecolor','none','facecolor',kolor); else hva=patch('xdata',tt,'ydata',polarity*ss,... 'edgecolor','none','facecolor',kolor); end if(dir==1) h=line(s,t,'color',kolor); else h=line(t,s,'color',kolor); end if(nargout==1) h=[h hva]; clear hva; end
function fact=plotseis(smat,t,x,vaflag,fact,flipy,kolor,hax) % % fact=plotseis(smat,t,x,vaflag,fact,flipy,kolor,hax) % % PLOTSEIS does a quick plot of a seismic matrix in a figure window (made by plotseis). % It plots the columns as wiggle traces centered at their x coordinates. % Type plotseis with no arguments for a demo. % % smat...the seismic matrix to be plotted. Traces are assumed stored in % the columns smat. % t...time coordinates of traces. % ******default 0:.00w:(nrows-1)*.002 where nrows=number of rows in smat****** % vaflag...if 0, then the traces are plotted as wt (wiggle traces) % if 1, then the traces are plotted wtva (shaded peaks) % if 2 the reverve polarity wtva (shaded troughs) % *************default=1************* % fact...scaling factors. Make fact(1) bigger for bigger wiggle % traces. fact(2) controls the overall plot scale. If not % provided, it is computed as max(abs(smat)). To scale two % plots the same, capture the return value from the first and % provide is as fact(2) for the second % *************default=1.5************* % flipy...if1, then the y axis is reversed so that it goes from top % of window to the bottom % *************default=1************* % kolor...color to plot the traces
% % % % % % % % % % % % % % % %
*************default=[1 0 0] (red)************* hax...handle of the axis to plot the seismic matrix in. If -1, then a new figure is created. *************default=-1************* NOTE: To scale two plots with respect to the maximum absolute value on the first plot, capture the return value from the first and provide it as the fifth argument for the second plot: fact=plotseis(smat1,t1,x1); plotseis(smat2,t2,x2,1,fact); G.F. Margrave, Aug 1995 The CREWES Project Department of Geology and Geophysics The University of Calgary gary@geo.ucalgary.ca
if(nargin<1) % do a demo % make a fake reflectivity t=0:.002:1.0; r=randn(size(t)).^5; % make a ricker wavelet tw=-.1:.002:.1; arg=(pi*15*tw).^2; w=(1-2.*arg).*exp(-arg); % convolve s=conv(r,w); s=s(51:length(t)+50)'; s=s/max(s); smat=s*ones(1,20); end if(nargin<8) hax=-1; end if(nargin<7) kolor=[0 0 0]; end if(nargin<6) flipy=1; end if(nargin<5) fact=1.5; end if(nargin<4) vaflag=1; end if(nargin<3) ncols=size(smat,2); x=1:ncols; end if(nargin<2)
nrows=size(smat,1); t=0:.002:(nrows-1)*.002; end if(length(x)>1) bnds=(max(x)-min(x))/(length(x)+1); else bnds=max(smat-min(smat))/2; end if (length(fact)<2) ilive=find(~isnan(smat)); trcmin=min(smat(ilive)); trcmax=max(smat(ilive)); s=max([abs(trcmax) abs(trcmin)]); fact=[fact s]; end if(hax==-1) figure; else hfig=get(hax,'parent'); figure(hfig); set(hfig,'currentaxes',hax); end if(flipy) set(gca,'ydir','reverse'); end for k=1:length(x) trc=smat(:,k)/fact(2); ilive=find(~isnan(trc)); m=mean(trc(ilive)); trc=(trc-m)*bnds*fact(1)+x(k); if(~vaflag) line(trc(ilive),t(ilive),'color',kolor); elseif(vaflag==1) if(length(ilive)<length(trc)) idead=find(isnan(trc)); trc(idead)=x(k)*ones(size(idead)); end wtva(trc,t,kolor,x(k),1,1); elseif(vaflag==2) wtva(trc(ilive),t(ilive),kolor,x(k),-1,1); end end