% polfig2.m   96/07/21
%
% Create a infinitesimal sector in polar coordinates between r and r+dr
% theta and theta+d(theta), and z and z+dz

    con=pi/180;
    c=25*con;
    d=45*con;
    theta=c+(d-c)*(0:20)/20;
    a=.8;
    b=1.2;
    z1=.9;
    z2=1.3;
    xmax=1.5;
    ymax=1.5;
    zmax=1.5;

    hold off;

% set x and y axes

    plot3([0 0],[0 ymax],[0 0],'w-');
    hold on;
    plot3([0 xmax],[ymax ymax],[0 0],'w-');
    view(60,30)

% In xy plane

%    plot3([a*cos(c) b*cos(c)],[a*sin(c) b*sin(c)],[0 0],'w-');
%    plot3([a*cos(d) b*cos(d)],[a*sin(d) b*sin(d)],[0 0],'w-');
%    plot3([a*cos(theta)],[a*sin(theta)],[z1*zeros(size(theta))],'w-')
%    plot3([b*cos(theta)],[b*sin(theta)],[z2*zeros(size(theta))],'w-')
    plot3([0 a*cos(c)],[0 a*sin(c)],[z1 z1],'w--');
    plot3([0 a*cos(d)],[0 a*sin(d)],[z1 z1],'w--');
    plot3([0 a*cos(c)],[0 a*sin(c)],[z2 z2],'w--');
    plot3([0 a*cos(d)],[0 a*sin(d)],[z2 z2],'w--');

% lower level

    plot3([a*cos(c) b*cos(c)],[a*sin(c) b*sin(c)],[z1 z1],'w-');
    plot3([a*cos(c) b*cos(c)],[a*sin(c) b*sin(c)],[z2 z2],'w-');
    plot3([a*cos(theta)],[a*sin(theta)],[z1*ones(size(theta))],'w-')
    plot3([a*cos(theta)],[a*sin(theta)],[z2*ones(size(theta))],'w-')

% upper level

    plot3([a*cos(d) b*cos(d)],[a*sin(d) b*sin(d)],[z1 z1],'w-');
    plot3([a*cos(d) b*cos(d)],[a*sin(d) b*sin(d)],[z2 z2],'w-');
    plot3([b*cos(theta)],[b*sin(theta)],[z1*ones(size(theta))],'w-')
    plot3([b*cos(theta)],[b*sin(theta)],[z2*ones(size(theta))],'w-')

%   

    plot3([a*cos(c) a*cos(c)],[a*sin(c) a*sin(c)],[z1 z2],'w-');
    plot3([a*cos(d) a*cos(d)],[a*sin(d) a*sin(d)],[z1 z2],'w-');
    plot3([b*cos(c) b*cos(c)],[b*sin(c) b*sin(c)],[z1 z2],'w-');
    plot3([b*cos(d) b*cos(d)],[b*sin(d) b*sin(d)],[z1 z2],'w-');


    axis([0 xmax 0 ymax 0 zmax]);
    axis square;

% Text

%    xlabel('x');
%    ylabel('y');
    text(.8,-.3,0,'x');
    text(-.3,.4,0,'y');
    text(-.2,-.2,.8,'z'); 
    text(.9,.9,1.1,'dz');
    text(0.2,0.2,1.5,'angle=d(theta)');
    draw3([.4;.4;1.45],[.5;.5;1.25],'w-');
%    text(1,.8,0,'d(theta)');
    text(1.1,.2,1,'dr');
%    text(1.0,.25,0,'dr');
