function DipoleArray(Arraytype,Distancetype,Phasetype);

helpinfo=strvcat(['The Demo is not ready'... 
      .'],[' '],...
      [' '],[' @2004 Xiaowei He & Markus Zahn. All Rights Reserved.']);
if nargin==0,
   diagHndl=helpdlg(helpinfo,'Information');
   
elseif nargin==1,
   diagHndl=helpdlg(helpinfo,'Information');
   
elseif nargin==2,
   diagHndl=helpdlg(helpinfo,'Information');
   
elseif nargin==3,
    Array = [1,2,3];
    Distance = [1/4,1/2,1,2];
    Phase = [0, pi/2, pi, 1.5*pi];
	N = Array(Arraytype);
	a = Distance(Distancetype);
    chi = Phase(Phasetype);
    dip = linspace(1,2*N+1,2*N+1);
    phi = linspace(0, 2*pi, 360);
    j = 0;
    
    for i = 1:360
        denom = sin(1/2*(2*pi*a*cos(phi(i))-chi))^2;
        
        if denom ~= 0
            j = j+1;
            phir(j) = phi(i);
            rr(j) = sin((N+1/2)*(2*pi*a*cos(phi(i))-chi))^2/denom;
        end
        
    end
    
    rmax = max(rr);
    rr = rr/rmax;
    figArray=figure( ...
      'Name','Radiation of Dipole Arrays', ...
      'NumberTitle','off', ...
      'Visible','on', ...
      'BackingStore','off');
    set(figArray,'Position',[64,91,600,600]);
    polar(phir,rr);
    title([  'Radiation pattern of ', num2str(2*N+1),' dipole array, with '...
            ,num2str(chi*360/(2*pi)),' degree phase shift and '...
            ,num2str(a),' \lambda apart in the \theta = \pi/2 plane.'],'fontsize', 8);
    text(0.9,0,'X');
    text(0,0.9,'Y');
	hold on
	plot((dip-N-1)/(2*N),dip*0,'or')
	hold off
end
