%
%  find_circular_plot_node.m  ver 1.0  October 1, 2012
%
function[plot_dof,sn]=find_circular_plot_node(nodex,nodey)
%
    disp(' ');
    disp(' Select response node input method ')
    disp(' 1= Enter node number ');     
    disp(' 2= Enter coordinate (x & y) ');    
    disp(' 3= Enter coordinate (radius & angle) ');
    disp(' 4= Center node ');
%    
    imeth=input(' ');
%   
    disp(' ');
    if(imeth==1)
        sn=input(' Enter node number ');
    end
%   
    if(imeth==2)
        x=input(' Enter x ');
        y=input(' Enter y ');        
    end    
%   
    if(imeth==3)
        r=input(' Enter radius ');
        a=input(' Enter angle (deg) ');
        a=a*180/pi;
        x=r*cos(a);
        y=r*sin(a);
    end
%
    if(imeth==4)
        x=0;
        y=0;        
    end    
%
    if(imeth==2 || imeth==3 || imeth==4)
        num=size(nodex);
        err=1.0e+20;
        for i=1:num
            dd=sqrt( ( x-nodex(i)  )^2 +( y-nodey(i) )^2 );
            if(dd<err)
                sn=i;
                err=dd;
            end
        end
%        
        out1=sprintf('\n Nearest node is %d  \n',sn);
        disp(out1);
%
    end
%
    plot_dof=3*sn-2;