clear
close

load d2_d;
size(d2_d)
n1=d2_d(1,1)+1
n2=d2_d(1,2)
r1=d2_d(1,3)
r2=d2_d(1,4)
if n2~=0
   n2=n2+1
end
freq=d2_d(2,1)
vs=d2_d(2,2)
vp=d2_d(2,3)

subplot(1,2,1)
for j=1:n1
  r(j) =d2_d(j+2,1);
  us(j)=d2_d(j+2,2);
  ur(j)=d2_d(j+2,3);
  ui(j)=d2_d(j+2,4);
  ua(j)=sqrt(ur(j)^2+ui(j)^2);
end
rmax=max(r);
umax=max(us);
umaxA=max(ua);
if umaxA > umax
  umax=umaxA;
end
Zs=d2_d(n1+n2+3,1)
plot(r,us,r,ur,':',r,ui,'-.',r,ua,'--')
title('u1 (Zoom Up)')
set(gca, 'box','on')
axis([0 rmax 0 umax*1.1])
text(rmax*0.25,umax*1.01,'Solid  : Static')
text(rmax*0.25,umax*0.96,'dotted : Dynamic(R)')
text(rmax*0.25,umax*0.91,'dashdot: Dynamic(I)')
text(rmax*0.25,umax*0.86,'dashed : Dynamic(A)')
text(rmax*0.5,umax*0.75,['Vs =',num2str(vs)])
text(rmax*0.5,umax*0.70,['Vp =',num2str(vp)])
text(rmax*0.5,umax*0.65,['Zs =',num2str(Zs)])
text(rmax*0.5,umax*0.60,['R1 =',num2str(r1)])
text(rmax*0.5,umax*0.55,['R2 =',num2str(r2)])
text(rmax*0.5,umax*0.50,['n1 =',num2str(n1-1)])
text(rmax*0.5,umax*0.45,['n2 =',num2str(n2-1)])
xlabel('r (0 - R1)')
ylabel('integrand')

subplot(1,2,2)
for j=1:n1+n2
  r(j) =d2_d(j+2,1);
  us(j)=d2_d(j+2,2);
  ur(j)=d2_d(j+2,3);
  ui(j)=d2_d(j+2,4);
  ua(j)=sqrt(ur(j)^2+ui(j)^2);
end
rmax=max(r);
umax=max(us);
if umaxA > umax
  umax=umaxA;
end
sumS1=d2_d(n1+n2+3,2)
sumS2=d2_d(n1+n2+3,3)
sumST=d2_d(n1+n2+3,4)
sumR1=d2_d(n1+n2+4,1)
sumI1=d2_d(n1+n2+4,2)
sumR2=d2_d(n1+n2+4,3)
sumI2=d2_d(n1+n2+4,4)
plot(r,us,r,ur,':',r,ui,'-.',r,ua,'--')
axis([0 rmax 0 umax*1.1])
text(rmax*0.3,umax*1.01,['Static:'])
text(rmax*0.3,umax*0.96,[' sum1=',num2str(sumS1)])
text(rmax*0.3,umax*0.91,[' sum2=',num2str(sumS2)])
text(rmax*0.3,umax*0.86,[' Total=',num2str(sumST)])
text(rmax*0.3,umax*0.80,['Dynamic at ',num2str(freq),' (Hz):'])
text(rmax*0.3,umax*0.75,[' sum1(R)=',num2str(sumR1)])
text(rmax*0.3,umax*0.70,[' sum2(R)=',num2str(sumR2)])
text(rmax*0.3,umax*0.65,[' Total(R)=',num2str(sumR1+sumR2)])
text(rmax*0.3,umax*0.60,[' sum1(I)=',num2str(sumI1)])
text(rmax*0.3,umax*0.55,[' sum2(I)=',num2str(sumI2)])
text(rmax*0.3,umax*0.50,[' Total(I)=',num2str(sumI1+sumI2)])
a=sqrt((sumR1+sumR2)^2+(sumI1+sumI2)^2);
text(rmax*0.3,umax*0.44,[' Total(Abs)=',num2str(a)])
title('u1+u2 (Total)')
title('u1+u2 (Total)')
set(gca, 'box','on')
xlabel('r (0 - R2)')
ylabel('integrand')

print dynamic2.ps



