z=0:.01:3*pi;
m=0;
t1=tan(z-pi/4-m*pi/2); i1=find(t1>10); t1(i1)=NaN;
t2=tan(2*z-pi/4-m*pi/2); i2=find(t2>10); t2(i2)=NaN;
figure;
plot(z,t1,'r--',z,t2,'b','linewidth',[2]); xlabel('z'); set(gca,'ylim',[-8 8]); ...
    legend('tan(z-\pi/4)','tan(2z-\pi/4)'); grid;
print -depsc2 tantan.eps
%%%%%%%%%%%%%%%%%%%%5
%  now find the first root of the J0(z)Y0(2z)-J0(2z)Y0(z)
%%%%%%%%%%%%%%%%%%%%%%
f0=inline('besselj(0,z).*bessely(0,2*z)-besselj(0,2*z).*bessely(0,z)');
f1=inline('besselj(1,z).*bessely(1,2*z)-besselj(1,2*z).*bessely(1,z)');
f2=inline('besselj(2,z).*bessely(2,2*z)-besselj(2,2*z).*bessely(2,z)');
figure
plot(z,f0(z),z,f1(z),z,f2(z)); grid; xlabel('z');legend('f_0(z)','f_1(z)','f_2(z)');
z0=fzero(f0,2);
lambda=z0^2;
str=sprintf('first zero at z=%g, lambda=%g',z0,lambda);
disp(str);