function [] = prob_3_9(d,X) % % 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. % %----- P = [ 1, 1 ]; solinit = bvpinit(linspace(d,X),@guess,P); sol = bvp4c(@f,@bcs,solinit,[],d,X); figure; p1 = plot( [ 0 sol.x], [ 1 sol.y(1,:)], '-bo' ); hold on; legend( [ p1 ], 'f(x)' ); grid on; title( [ '(d,X) = (', num2str(d),',',num2str(X),')' ] ); axis( [ 0 15 0 1 ] ); sol.parameters(1) function [ v ] = guess(x,P,d,X) % GUESS - % if( x < 1 ) v = [ 1; 0; ]; else v = [ 144*x^(-3); -432*x^(-4) ]; end function [res] = bcs(ya,yb,P,d,X) % BCS - % gamma = (1-sqrt(73))/2; res = [ ya(1) - ( 1 + P(1)*d + (4/3)*(d^(3/2)) + (2*P(1)/5)*(d^(5/2)) ); ya(2) - ( P(1) + 2*sqrt(d) + P(1)*(d^(3/2)) ); yb(1) - ( 144*X^(-3) + P(2)*X^gamma ); yb(2) - ( -3*144*X^(-4) + P(2)*gamma*X^(gamma-1) ); ]; function [ ode ] = f(x,y,P,d,X) % F - % y(1)=y(x); y(2)=y'(x); % ode = [ y(2); (max(y(1),0)^(3/2))/sqrt(x); ];