function phase_plot(F) 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)'); Beta_value=uicontrol('style','edit',... 'units','normal',... 'position',[.25 .02 .08 .06],... 'string','b'); F_with_b=regexprep(F,'b','.1') func=inline(F_with_b,'t','y','b'); while get(gcf,'userdata')==0 pause(.25) v0=4.5; if get(gcf,'userdata')==1 set(gcf,'Pointer','watch'); new_b=get(Beta_value,'string'); F_with_b=regexprep(F,'b',new_b); func=inline(F_with_b,'t','y','b'); set(gcf,'userdata',0); cla; for i=1:6 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'); x_bar=[x_limit(1):.1:x_limit(2)];zero_x=zeros(1,length(x_bar)); y_bar=[y_limit(1):.1:y_limit(2)];zero_y=zeros(1,length(y_bar)); hor_ver=plot(x_bar,zero_x,'black',... zero_y,y_bar,'black'); set(hor_ver,'linewidth',.); end end new_b=get(Beta_value,'string'); set(gcf,'pointer','arrow') title=['\beta=' new_b]; set(get(gca,'Title'),'string',title); end