%program to plot the reflection-transmission coefficients calculated %coeff.f %clean up the memory clear; % opening input file filename=input('Input file: ','s'); filein=fopen(filename,'r'); % read type of interface and incoming wave, no.of waves generated titre=fgetl(filein); coeff=fgetl(filein); nwave=str2num(coeff(26:26)) wave1=fgetl(filein); if nwave>1; wave2=fgetl(filein); end; if nwave>2; wave3=fgetl(filein); end; if nwave>3; wave4=fgetl(filein); end; % read number of points [nparam]=fscanf(filein,'%i',2); ndata=nparam(1); ncolumn=(nwave*2)+1; %flag=input('enter 0 for the SH case, 1 for the P-SV case ,2 for fluid-solid, 3 for free-SH, 4 for free-P-SV:'); %ncolumn=9; %if flag==0; ncolumn=5; end; %if flag==2; ncolumn=7; end; %if flag==3; ncolumn=3; end; %if flag==4; ncolumn=5; end; % read data for iz=1:ndata; [bid]=fscanf(filein,'%f',ncolumn) ; slo(iz)=bid(1); nsamp=(ncolumn-1)/2; for j=1:nsamp; amp(j,iz)=bid(2*(j-1)+2); fase(j,iz)=bid(2*(j-1)+3); end; end; % plot amplitude and phase of the coefficients if ncolumn==9; plot(slo,amp(1,:),'k-',slo,amp(2,:),'k:',slo,amp(3,:),'k-.',slo,amp(4,:),'k--'); % legend('1','2','3','4'); legend(wave1,wave2,wave3,wave4); title(titre,'FontSize',13); xlabel('horizontal slowness (s/km)','FontSize',11); figure; plot(slo,fase(1,:),'k-',slo,fase(2,:),'k:',slo,fase(3,:),'k-.',slo,fase(4,:),'k--'); legend(wave1,wave2,wave3,wave4); title(titre,'FontSize',13); xlabel('horizontal slowness (s/km)','FontSize',11); end; if ncolumn==7; plot(slo,amp(1,:),'k-',slo,amp(2,:),'k:',slo,amp(3,:),'k-.'); legend(wave1,wave2,wave3); title(titre,'FontSize',13); xlabel('horizontal slowness (s/km)','FontSize',11); figure; plot(slo,fase(1,:),'k-',slo,fase(2,:),'k:',slo,fase(3,:),'k-.'); legend(wave1,wave2,wave3); title(titre,'FontSize',13); xlabel('horizontal slowness (s/km)','FontSize',11); end; if ncolumn==5; plot(slo,amp(1,:),'k-',slo,amp(2,:),'k:'); legend(wave1,wave2); title(titre,'FontSize',13); xlabel('horizontal slowness (s/km)','FontSize',11); figure; plot(slo,fase(1,:),'k-',slo,fase(2,:),'k:'); legend(wave1,wave2); title(titre,'FontSize',13); xlabel('horizontal slowness (s/km)','FontSize',11); end; if ncolumn==3; plot(slo,amp(1,:),'k-'); legend(wave1); title(titre,'FontSize',13); xlabel('horizontal slowness (s/km)','FontSize',11); figure; plot(slo,fase(1,:),'k-'); legend(wave1); title(titre,'FontSize',13); xlabel('horizontal slowness (s/km)','FontSize',11); end;