%
%  circular_plate_base_fea_post.m  ver 1.1  October 1, 2012
%
function[trans_acc_frf,trans_vel_frf,trans_disp_frf,trans_rel_disp_frf]=...
   circular_plate_base_fea_post(con_dof,num_con_dof,nodex,nodey,acc_frf,...
                                                  freq,fstart,fend,fig_num)
%
con_dof=sort(con_dof);
%
for i=1:num_con_dof
    ijk=con_dof(i);
    [acc_frf]=add_column(acc_frf,ijk);
end
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
freq=freq';
omega=2*pi*freq;
%%
%
nfreq=max(size(freq));
%
sz=size(acc_frf);
nnn=sz(2);
%
trans_acc_frf=zeros(nfreq,nnn);
trans_vel_frf=zeros(nfreq,nnn);
trans_disp_frf=zeros(nfreq,nnn);
%
for i=1:nnn
%    
     trans_acc_frf(:,i)=acc_frf(:,i);
%     
     for j=1:nfreq
         trans_vel_frf(j,i)=acc_frf(j,i)/omega(j);    
        trans_disp_frf(j,i)=acc_frf(j,i)/omega(j)^2;
%
        trans_rel_disp_frf(j,i)=trans_disp_frf(j,i) - 1/omega(j)^2;
%
     end
%     
end
%
         trans_acc_frf=abs( trans_acc_frf  );
         trans_vel_frf=abs( trans_vel_frf  ); 
        trans_disp_frf=abs( trans_disp_frf ); 
    trans_rel_disp_frf=abs( trans_rel_disp_frf );     
%
         trans_vel_frf=trans_vel_frf*386;
        trans_disp_frf=trans_disp_frf*386;
    trans_rel_disp_frf=trans_rel_disp_frf*386;
%%
i=1;
while(i==1)
%
    [plot_node,sn]=find_circular_plot_node(nodex,nodey);
%
    figure(fig_num);
    fig_num=fig_num+1;
    plot(freq,trans_acc_frf(:,plot_node));
    grid on;
    xlabel('Frequency (Hz)');
    ylabel('Response Accel/Base Accel (G/G) ');
%
    out1=sprintf(' Accel FRF  Node %d, x=%8.4g  y=%8.4g in',...
                                                   sn,nodex(sn),nodey(sn));
    title(out1);
%
    set(gca,'MinorGridLineStyle',':','GridLineStyle',':','XScale',...
               'log','YScale','log','XminorTick','on','YminorTick','on');           
%
    [fmin,fmax,ymin,ymax]=find_plot_limits(freq,trans_acc_frf(:,plot_node));
    axis([fstart,fend,ymin,(ymax*1.01)])
%
    figure(fig_num);
    fig_num=fig_num+1;
    plot(freq,trans_rel_disp_frf(:,plot_node));
    grid on;
    xlabel('Frequency (Hz)');
    ylabel('Response Relative Displacement/Base Accel (in/G) ');
%
    out1=sprintf(' Rel Disp FRF  Node %d relative to Base, x=%8.4g  y=%8.4g in',...
                                                   sn,nodex(sn),nodey(sn));
    title(out1);
%
    set(gca,'MinorGridLineStyle',':','GridLineStyle',':','XScale',...
               'log','YScale','log','XminorTick','on','YminorTick','on');           
%
    [fmin,fmax,ymin,ymax]=find_plot_limits(freq,trans_rel_disp_frf(:,plot_node));
    axis([fstart,fend,ymin,(ymax*1.01)]);    
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
    af=[freq trans_acc_frf(:,plot_node) ];
%
    [xmax,ymax]=find_max(af);
    disp(' ');
    out1=sprintf('    Accel FRF:  max = %8.3g G/G at %8.4g Hz  ',xmax,ymax);
    disp(out1);    
%    
    rf=[freq trans_rel_disp_frf(:,plot_node) ];
%
    [xmax,ymax]=find_max(rf);
    out1=sprintf(' Rel Disp FRF:  max = %8.3g in/G at %8.4g Hz  ',xmax,ymax);
    disp(out1);    
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
    disp(' ');
    disp(' Plot another nodal response?  1=yes 2=no ');
    i=input(' ');
%
end