function [] = prob_3_4() % PROB_3_4 - % % Written by: % -- % John L. Weatherwax 2005-04-13 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- global d; d = 0.001; solinit = bvpinit(linspace(d,0.5,10),@guess); sol = bvp4c(@f,@bcs,solinit); xall = linspace(0,0.5,100); yaall = sf(xall); p0=plot( xall, yaall, '-or' ); hold on; p1=plot( [ 0 sol.x], [ 0 sol.y(1,:)], '-bo' ); grid on; axis( [ 0 0.5 0 0.5 ] ); function [ v ] = guess(x) % GUESS - % y = x.*(1-x); yp = 1-2*x; v = [ y; yp ]; function [res] = bcs(ya,yb) % BCS - % global d; res = [ ya(1)-sf(d) yb(2); ]; function [ ode ] = f(x,y) % F - % y(1)=y; y(2)=y' % ode = [ y(2); -1/y(1) ]; function yout = sf(xall) % SF - % yout = xall.*sqrt(-2*log(xall+eps));