%
%  rectangular_elements_plot_modes.m  ver 1.0  September 5, 2012
%
function[fig_num]=...
rectangular_elements_plot_modes(nodex,nodey,fig_num,ModeShapes,fn,number_nodes)
%
disp(' ');
disp(' Plot modes shapes?  1=yes  2=no ');
ips=input(' ');
%
disp(' ');
disp(' Note that the plotting elements are triangular ');
disp(' even though the FEA model elements are rectangular. ');
%
if(ips==1)
    clear aaa;
    clear abc;
    abc=zeros(number_nodes,2);
    abc=[ nodex  nodey ];
    aaa=max(abc);
    xmin=-aaa;
    ymin=-aaa;
    xmax=aaa;
    ymax=aaa;
end    
while(ips==1)
    clear zzr;
    zzr=zeros(number_nodes,1);
    disp(' ');
    mode_num=input(' Enter mode number ');
%
    figure(fig_num);
    fig_num=fig_num+1;
%    
    for i=1:number_nodes
        ndof=3*i-2;
        zzr(i)=ModeShapes(ndof,mode_num);
    end
%
    zmax=max(zzr);
    zmin=min(zzr);   
%    
    tri = delaunay ( nodex, nodey );
    trisurf ( tri, nodex, nodey, zzr );
%
    out1=sprintf(' Mode %d   fn=%8.4g Hz',mode_num,fn(mode_num));
    title(out1);
    grid on;
%    
    disp(' ');
    disp(' Plot another mode?  1=yes  2=no ');
    iam=input(' ');
    if(iam==2)
        break;
    end
%
end