% PHD_skin1  plots skin depth v. frequency

clear
filetype = '-dtiff';
fig=1;

figure(fig);  

Xrange = 6;
freq = logspace(2, 2 + Xrange, (10*Xrange + 1));

for sigma=logspace(-6, 0, 7)
    loglog( freq, skindepth(2*pi*freq,sigma,1) ,'k-','linewidth',2)
    hold on
    loglog( freq, skindepth(2*pi*freq,sigma,3) ,'b-','linewidth',1)
    loglog( freq, skindepth(2*pi*freq,sigma,5) ,'b-','linewidth',1)
    loglog( freq, skindepth(2*pi*freq,sigma,10) ,'b-','linewidth',1)
end

sigma = logspace(-6, 0, 7);
eps = 8.85E-12;
erel=1;
loglog( sigma/eps/2/pi, skindepth(sigma/eps,sigma,1) ,'bo','linewidth',2)
erel=3; eps1 = eps*erel;
loglog( sigma/eps1/2/pi, skindepth(sigma/eps1,sigma,erel) ,'bo','linewidth',2)
erel=5; eps1 = eps*erel;
loglog( sigma/eps1/2/pi, skindepth(sigma/eps1,sigma,erel) ,'bo','linewidth',2)
erel=10; eps1 = eps*erel;
loglog( sigma/eps1/2/pi, skindepth(sigma/eps1,sigma,erel) ,'bo','linewidth',2)



axis([100 1E8 2 2000]);

set(gca, 'XTick', logspace(2, 2 + Xrange, Xrange + 1) );
set(gca,'LineWidth',1.5,'FontSize',12,'TickDir','out')

shift=1.3; posn=2E3;
text(shift*posn,   skindepth(   posn*2*pi,1,1),   '1S/m')
text(shift*2*posn, skindepth( 2*posn*2*pi,0.1,1), '100mS/m')
text(shift*4*posn, skindepth( 4*posn*2*pi,0.01,1),'10mS/m')
text(shift*8*posn, skindepth( 8*posn*2*pi,1E-3,1),'1mS/m')
text(shift*16*posn,skindepth(16*posn*2*pi,1E-4,1),'100\muS/m')
text(shift*32*posn,skindepth(32*posn*2*pi,1E-5,1),'10\muS/m')

shift=1.2;
text(1E7,shift*skindepth(1E7*2*pi,1E-4,1), '\epsilonrel=1')
text(1E7,shift*skindepth(1E7*2*pi,1E-4,3), '\epsilonrel=3')
text(1E7,shift*skindepth(1E7*2*pi,1E-4,5), '\epsilonrel=5')
text(1E7,shift*skindepth(1E7*2*pi,1E-4,10),'\epsilonrel=10')


xlabel('Frequency (Hz)','fontsize',12)
ylabel('Skin Depth (m)','fontsize',12)
title('Skin depth v. Frequency','fontsize',12)

print(filetype, '', ['skin-' num2str(fig)] )
