%
%  pf_emm_fea_post1.m  ver 1.1  September 6, 2012
%
function[pdof]=pf_emm_fea_post1(mass_unc,dof,fn,total_mass,mode)
%
%  The accuracy decreases with mode number.
%
    mass=mass_unc;
    v=ones(dof,1);
    LM=mode'*mass*v;
    pf=LM;
    sum=0;
%    
    mmm=mode'*mass*mode;   
%  
    clear length;
    nndd=length(pf);
    for i=1:nndd
        pff(i)=pf(i)/mmm(i,i);
        emm(i)=pf(i)^2/mmm(i,i);
        if(emm(i) < 1e-30)
            emm(i)=0.;
            pff(i)=0.;
        end    
%
        sum=sum+emm(i);
    end
%
    pdof=length(emm);
    if(pdof>40)
        pdof=40;
    end
%
    disp(' ');
    disp('                                        Effective            ');
    disp('           Natural     Participation    Modal Mass   Mass    ');
    disp('Mode       Freq(Hz)       Factor          (lbm)      Percent ');
%    
    for i=1:pdof
        frac=100*emm(i)/total_mass;
        if(frac<0.0001)
            frac=0;
        end
        out1 = sprintf('  %d \t %11.5g \t %9.5f \t %9.5f \t %7.3f',i,fn(i),pff(i),386*emm(i),frac);
        disp(out1)
    end        
%
    disp(' ')
    out1 = sprintf(' Total Effective Modal Mass = %10.4g lbf sec^2/in',sum );
    out2 = sprintf('                            = %10.4g lbm',sum*386 );
    disp(out1)
    disp(out2)
%