disp(' ');
disp(' continuous_beam_base_accel.m  ver 1.3  October 15, 2012');
disp(' by Tom Irvine  Email: tom@vibrationdata.com ');
disp(' ');
disp(' This script calculates the normal modes for Bernoulli-Euler ');
disp(' beam bending.  It also has options for base excitation. ');
disp(' ');
%
close all hidden;
%
clear part;
clear root;
clear f;
clear H;
clear HA;
clear beta;
clear fn;
clear YY;
%
clear absolute_accel_H;
clear relative_disp_H;
clear acc_power_trans;
clear rd_power_trans; 
clear accel_psd_resp;
clear rd_psd_resp;
clear accel_arb_resp; 
clear rd_arb_resp; 
%
disp(' ');
disp(' Select units: 1=English 2=metric ');
iu=input(' ');
%
fig_num=1;
%
disp(' Enter number of modes ');
n = input(' ');
%
[ccc,A,I,L]=geometry_entry(iu);
%
[E,rho,v]=materials(iu);
%
rho=rho*A;   % mass per unit length
%
EI_term = sqrt(E*I/rho);
%
mass=rho*L;
%
sq_mass=sqrt(mass);
%
[ModeShape,ModeShape_dd,beta,C,fn,part,emm,ibc]=...
                                   continuous_beam_bc(L,n,EI_term,mass,iu);
%     
%
nb=201;
%
for ijk=1:n
%
    clear x;
    clear y;
    x=zeros(nb,1);   
    y=zeros(nb,1);
    dx=L/(nb-1);
    for i=1:nb
        x(i)=(i-1)*dx;
        arg=beta(ijk)*x(i);
        y(i)=ModeShape(arg,C(ijk),sq_mass);
    end
%
    figure(fig_num);
    fig_num=fig_num+1;
    plot(x,y);
    out1=sprintf('Mode %d   fn=%8.4g Hz',ijk,fn(ijk));
    title(out1);
    xlabel('x (inch) ');
    grid on;
%
end
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
disp(' ');
disp(' Perform base excitation analysis? 1=yes 2=no ');
ibase=input(' ');
%
if(ibase==1)
%    
    [damp]=enter_modal_damping(n);
%    
    disp(' ');
    if(iu==1)
        disp(' Enter distance x (inch) from left boundary to point of interest ');
    else
        disp(' Enter distance x (meters) from left boundary to point of interest ');       
    end
    x=input(' ');
    if(x>L)
        disp(' Warning: x reset to total length');
        x=L;
    end
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
 [fig_num,absolute_accel_H,relative_disp_H,Hmom]=...
    continuous_beam_base_frf(ModeShape,ModeShape_dd,sq_mass,beta,C,part,...
                                               fn,fig_num,x,damp,L,E,I,iu);
%
    disp(' ');
    disp(' Calculate specific case for sine excitation? ');
    disp(' 1=yes  2=no ');
%
    ib=input(' ');
%    
    if(ib==1)
%
       [~]=continuous_beam_base_sine(ModeShape,ModeShape_dd,fn,beta,C,...
                                             part,sq_mass,damp,x,E,I,L,iu);
    end
%
    disp(' ');
    disp(' Apply PSD base input?  1=yes  2=no ');
    ipsd=input(' ');
    if(ipsd==1) 
%
        [fig_num,accel_psd_resp,rd_psd_resp,acc_power_trans,rd_power_trans]=...
         continuous_beam_base_PSD(iu,absolute_accel_H,relative_disp_H,fig_num);
%
    end
%
    disp(' ');
    disp(' Apply half-sine base input?  1=yes  2=no ');
    ihs=input(' ');
    if(ihs==1) 
%
        [fig_num,acc_hs_resp,rd_hs_resp]=...
        continuous_beam_base_half_sine(iu,fn,damp,n,part,beta,C,x,...
                                                fig_num,ModeShape,sq_mass);
%
    end
%
%
%
    disp(' ');
    disp(' Apply arbitrary base input?  1=yes  2=no ');
    iarb=input(' ');
    if(iarb==1) 
%
        [fig_num,acc_arb_resp,rd_arb_resp,bm_arb_resp]=...
        continuous_beam_base_arbitrary(iu,fn,damp,n,part,ModeShape,...
                                ModeShape_dd,E,I,sq_mass,beta,C,x,fig_num);
%
    end
%
    disp(' ');
    disp(' Output arrays ');
    disp(' ');
    disp('  absolute_accel_H  ');
    disp('  relative_disp_H   ');
%
    if(ipsd==1)
        disp(' ');
        disp('  acc_power_trans ');
        disp('  rd_power_trans  ');        
        disp(' ');
        disp('  accel_psd_resp ');
        disp('  rd_psd_resp    ');
    end    
%
    if(ihs==1) 
        disp('  accel_hs_resp ');
        disp('  rd_hs_resp    ');       
    end 
%    
    if(iarb==1) 
        disp('  accel_arb_resp ');
        disp('  rd_arb_resp    ');       
    end    
%       
end