%
%  plot_modes.m  ver 1.1  January 15, 2014
%
function [pmode]=plot_modes(dof_status,mode,~,xv,fn,iu)
%
fig_num=1;
disp(' ');
orig_dof=length(dof_status);
dof_half=round(orig_dof/2);
%
choice=1;
%
for j=1:dof_half
%
    if(choice==1)
%      
      at = sprintf(' Mode %d   freq=%8.4g Hz',j,fn(j));
      pf_mode=mode(:,j);  
%
        for i=1:orig_dof
            if(dof_status(i)==0)
%       
                pf_mode=[pf_mode(1:(i-1));0;pf_mode(i:length(pf_mode))];
%
            end
        end
%
        pmode=zeros(dof_half);
%        
        for i=1:dof_half
            pmode(i)=pf_mode(2*i-1);
        end
%
        figure(fig_num);
        fig_num=fig_num+1;
%
        plot(xv,pmode); 
        grid;
        set(gca,'MinorGridLineStyle','none','GridLineStyle',':','XScale','lin','YScale','lin');    
        title(at);
        if(iu==1)
            xlabel('x (inch)'); 
        else
            xlabel('x (meters)');
        end    
        ylabel('modal displacement');
%
    end
%
    aq = sprintf(' Plot Mode %d ?',j+1);
    disp(aq);
    choice=input(' 1=yes  2=no  3=exit  ' );
%   
    if(choice==3)   
        break;
    end
%
end