function y = drums(R,n) % DRUMS: y = drums(R,n) % Uses numgrid to show eigenmodes of various drums. % Options for R are same as in numgrid; % 'S','L','C','A','D','H','B','N' % Note 'S' and 'N' produce the same picture but 'N' should run faster. % See sqgridorder for explanation of 'N'. Also note use of subplot. % Try "drums('L',20)". % (Tim Carlson, 2/02) % Mods,comments ELB. if mod(n,2) == 0, n = n+1; end g = numgrid(R,n); x=-1:2/(n-1):1; %only for axis purposes u = delsq(g)*n*n; [w,d] = eigs(u,3,0); for l=1:3 h = zeros(n); v=w(g(g>0),l); h(g>0)=v/norm(v,inf); subplot(2,2,l), mesh(x,x,h); axis tight, title(['evalue = ' num2str(d(l,l))]); end subplot(2,2,4), contour(x,x,g>0), axis([-1 1 -1 1])