function phase_plot(F,b,varagin)


%%This function will accept a differential equation in the form [y(2);
%%second derivative of y in terms of y(1) and y(2)] i.e. position and
%%velocity

figure;
clf reset;

set(gcf,'nextplot','add',...
    'userdata',0);
set(gca,'nextplot','add',...
    'position',[0.1 .175 .8 .8]);

xlabel('x');ylabel('v'); 

Change_button=uicontrol('string','Go',...
    'units','normal',...
    'pos',[0.1 .02 .1 .06],...
    'callback','set(gcf,''userdata'',1)');

if nargin > 1
    Beta_value=uicontrol('style','edit',...
    'units','normal',...
    'position',[.25 .02 .08 .06],...
    'string','b');
end

if nargin >1
F_with_b=regexprep(F,'b','.1')
func=inline(F_with_b,'t','y','b');
else
    func=inline(F,'t','y');
end


while get(gcf,'userdata')==0
    pause(.25)


if get(gcf,'userdata')==1
    set(gcf,'Pointer','watch');
    if nargin >1
    new_b=get(Beta_value,'string');
    F_with_b=regexprep(F,'b',new_b);
    func=inline(F_with_b,'t','y','b');
    else
    F_with_b=F;
    func=inline(F_with_b,'t','y');
    end
    set(gcf,'userdata',0);
    cla;
    
    for i=1:6
    v0=12;
    Initial_cond=[2*i-7;v0];
    [t,x]=ode45(func,[0,100],Initial_cond);
    plot(x(:,1),x(:,2));
    
    Initial_cond=[2*i-7;-v0];
    [t,x]=ode45(func,[0,100],Initial_cond);
    plot(x(:,1),x(:,2));
    
    Initial_cond=[.1;0];
    [t,x]=ode45(func,[0,100],Initial_cond);
    plot(x(:,1),x(:,2));
    
    x_limit=get(gca,'xlim');y_limit=get(gca,'ylim');
    line(x_limit,[0 0],'linewidth',0.125,'color','black');
    line([0 0],y_limit,'linewidth',0.125,'color','black');
    
    end

end

if nargin >1
new_b=get(Beta_value,'string');
else 
new_b=0;
end

set(gcf,'pointer','arrow')
title=['\beta=' new_b];
set(get(gca,'Title'),'string',title);

end
    

