%
disp(' ');
disp(' modal_density.m   ver 1.1   June 2, 2008 ');
disp(' by Tom Irvine, Email: tomirvine@aol.com ');
disp(' ');
disp(' This program calculates the modal density of a plate ');
disp(' for the bending modes. ');
%
%**************************************************************************
%
disp(' ');
    disp(' Select units:  1=English 2=metric ');
iu=input(' ');
%
if(iu==1)
    cref=200000.;
%
    disp(' ')
	disp(' Enter material:  1=aluminum  2=steel  3=other ')
    imat=input(' ');
%
    if(imat ~=1 & imat ~=2 & imat ~= 3)
		disp(' Input Error ');
    end
%
	if(imat==1)
		cmat=cref;
    end
	if(imat==2)
		cmat=cref;
    end
    if(imat==3)
		disp(' Enter the speed of sound in the material (in/sec) ');
   		cmat=input(' ');
    end
%
    disp(' Enter Length (inch) ');
    L=input(' ');
%
    disp(' Enter Width (inch) ');
    W=input(' ');
%
    disp(' Enter thickness (inch) ');
    H=input(' ');
else
    cref=5100;
%
    disp(' ')
	disp(' Enter material:  1=aluminum  2=steel  3=other ')
    imat=input(' ');
%
    if(imat ~=1 & imat ~=2 & imat ~= 3)
		disp(' Input Error ');
    end
%
	if(imat==1)
		cmat=cref;
    end
	if(imat==2)
		cmat=cref;
    end
    if(imat==3)
		disp(' Enter the speed of sound in the material (m/sec) ');
   		cmat=input(' ');
    end
%
    disp(' Enter Length (m) ');
    L=input(' ');
%
    disp(' Enter Width (m) ');
    W=input(' ');
%
    disp(' Enter thickness (mm) ');
    H=input(' ');
    H=H/1000.;
end
%
CL=cmat;
S=L*W;
%
MD=S/(3.6*CL*H);
MD=MD*2*pi;
%
if(iu==1)
    out1=sprintf('\n Speed of Sound in Material = %10.5g in/sec',CL);
      out2=sprintf('                            = %10.5g ft/sec',CL/12.);
    disp(out1);
    disp(out2); 
else
    out1=sprintf('\n Speed of Sound in Material = %9.4g m',CL);
    disp(out1); 
end
%
out1=sprintf('\n Modal Density = %8.4g modes/Hz',MD);
  out2=sprintf('               = %8.4g modes/radians',MD/(2*pi));
disp(out1);
disp(out2);
fs=1/MD;
out1=sprintf('\n Average Frequency Spacing = %8.4g Hz',fs);
disp(out1);