function ezpolar(varargin)
% EZPOLAR Easy to use polar coordinate plotter.
%   EZPOLAR(f) plots the polar curve rho = f(theta) over the
%   default domain 0 < theta < 2*pi.
%
%   EZPOLAR(f,[a,b]) plots f for a < theta < b.
%
%   Examples
%       ezpolar('1 + cos(t)')
%       ezpolar('cos(2*t)')
%       ezpolar('sin(tan(t))')
%       ezpolar('sin(3*t)')
%       ezpolar('cos(5*t)')
%       ezpolar('sin(2*t)*cos(3*t)',[0,pi])
%       ezpolar('1 + 2*sin(t/2)')
%       ezpolar('1 - 2*sin(3*t)')
%       ezpolar('sin(t)/t', [-6*pi,6*pi])
%
%       r = '100/(100+(t-1/2*pi)^8)*(2-sin(7*t)-1/2*cos(30*t))';
%       ezpolar(r,[-pi/2,3*pi/2])
%
%  See also EZPLOT3, EZPLOT, EZSURF, PLOT, PLOT3, POLAR

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.7 $  $Date: 2000/06/02 04:30:43 $
%   P.J. Costa and Clay Thompson

% If r = f(theta) is an inline function, then vectorize it as need be.
[rho,rho0,rhoargs] = ezfcnchk(varargin{1},0,'t');
if (length(rhoargs)>1)
   error('Cannot plot polar curves of more than 1 variable.');
end

Npts = 314;

% Determine the domain in t:
switch nargin
   case 1
      T =  linspace(0,2*pi,Npts);
   case 2
      T = linspace(varargin{2}(1),varargin{2}(2),Npts);
end

RHO = feval(rho,T);

% If RHO is constant (i.e., 1 by 1), then ...
if all( size(RHO) == 1 ), RHO = RHO.*ones(size(T)); end
polar(T,RHO);

text(0,-1.2*max(abs(RHO)),['r = ', texlabel(rho0)], ...
          'HorizontalAlignment','Center');
