%
%  code12.m -- (djm:  25 feb 2002)
%

x = 0:0.1:30;  xx = 3:0.1:30;

subplot(2,1,1)
plot(x,besselj(0,x))
hold on
plot([0 30],[0 0],'k')

%  plot envelopes

plot(xx, sqrt(2/pi./xx),'r--')
plot(xx,-sqrt(2/pi./xx),'r--')

%  plot zeros

zer = [2.4048255577 5.5200781103 8.6537279129 11.7915344391];

plot(zer,zeros(size(zer)),'k*')

hold off
axis([0 30 -0.5 1.0])

xlabel('\bf kr-axis')
ylabel('\bf J_0(kr)')
title('\bf zeroth bessel function')

text(2,0.7,['\bf zeros = ' num2str(zer)])

subplot(2,1,2)
xp = -zer(4):zer(4)/60:zer(4);
hold on

for t = 0:pi/3:2*pi
  plot(xp,cos(t)*besselj(0,abs(xp)))
end

axis([-zer(4) zer(4) -1 1])

xlabel('\bf kr-axis')
ylabel('\bf \eta(r,t)')
title('\bf snapshots of a standing wave')

hold off