shg         %This command brings the graph to the front of the screen
clf         %Clears plotting window
gcf         %Get Current Figure
            
x=(-1:0.01:1); %Preliminary Data
y=x*0;
zo=[x;y]
Theta=0;

Rotation_matrix=[cos(Theta) sin(Theta); -sin(Theta) cos(Theta)];

%Deal with axes so buttons don't get in way
axis_handle=axes;       
set(axis_handle,'position',[0.25 .25 .6 .6]);
set(axis_handle,'nextplot','add');
axis([-1 1 -1 1]);

picture=plot(x,y);

%%Set up Controls
set(gcf,'doublebuffer','on');
slide=uicontrol('style','slider','string','Rotation angle');
stop=uicontrol('style','toggle','string','stop');

%%Properties of Slider on Screen
set(slide,'position',[100 20 60 20]);
set(slide,'min',0,'max',2*pi);

get(slide)
get(stop)

i=1;
while get(stop,'value')==0
    Theta=get(slide,'value');
    Rotation_matrix=[cos(Theta) sin(Theta); -sin(Theta) cos(Theta)];
    z=Rotation_matrix*zo;
    set(picture,'xdata',z(1,:),'ydata',z(2,:));
    drawnow
    i=i+1;
    end