%
%  Name:   prntfreq.m
%
%  Usage:  prntfreq.m
%
%  Prints a table of the identified modes and frequencies
% 

%  Version SWD970618
%
%  Author(s): Scott W. Doebling, doebling@lanl.gov
%
%  Institution: Los Alamos National Laboratory,
%               ESA-EA
%
%  Copyright (c) 1996-1997, The Regents of the University
%       of California. (See top level of code for
%       full copyright statement.)
%
%   

disp(' ')
disp(' ')
disp(' ')
disp([' Identified Modes for ',filename])

if exist('Damp')==1, damp_prnt = Damp*100;
 else, damp_prnt = blanks(length(Freq));
end

titlestr = sprintf(' %4s %10s','Mode','Freq (Hz)');

if exist('Damp')==1, titlestr = [titlestr,sprintf(' %10s','Damp (%)')]; end

prtstr = titlestr;

for i = 1:length(Freq),
    newstr = sprintf(' %4d %10.3f',i,Freq(i));

    if exist('Damp')==1, newstr = [newstr,sprintf(' %10.3f',Damp(i)*100)]; end

    prtstr = [prtstr; newstr];
end

tp = size(prtstr,2);

prtstr = [blanks(tp);blanks(tp);prtstr;blanks(tp);blanks(tp)];

disp(prtstr)

%  See if statistical analysis results are present

if exist('Freqall') == 1,
   
    freqstr = sprintf('\n%-20s\n%7s%13s%15s%15s \n','Frequency Statistics','Mode #','Mean (Hz)','Abs 2Sig (Hz)','Rel 2Sig (%)');

    for i=1:size(Freqall,1)
       mfrq(i) = mean(Freqall(i,:));
       std2frqabs(i) = 2*std(Freqall(i,:));
       std2frqrel(i) = std2frqabs(i) / mfrq(i);
       freqstr = [freqstr, sprintf('%7i   %0.3e  %0.3e      %0.3e \n',...
             i,mfrq(i),std2frqabs(i),std2frqrel(i)*100)];
    end

    disp(freqstr)
    
end

%
%  Build string of damping statistics
%

if exist('Dampall') == 1,
   
   dampstr = sprintf('\n%-20s\n%7s%13s%15s%15s \n','Damping Statistics','Mode #','Mean (%)','Abs 2Sig (%)','Rel 2Sig (%)');

   for i=1:size(Dampall,1)
   
   mdamp(i) = mean(Dampall(i,:));
   std2dmpabs(i) = 2*std(Dampall(i,:));
   std2dmprel(i) = std2dmpabs(i) / mdamp(i);
   dampstr = [dampstr, sprintf('%7i   %0.3e   %0.3e     %0.3e \n',...
         i,mdamp(i)*100,std2dmpabs(i)*100,std2dmprel(i)*100)];
   end
   
   disp(dampstr)
   
end

   
   