function [] = prob_3_8_pt2(Z) % % In this implementation we use the derived asymptotic % expansions of the solution for large Z as the boundary % conditions. Note that for large Z the decay is so fast % that a singular Jacobian is encountered. % % 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 ]; solinit = bvpinit(linspace(0,Z),@guess,P); sol = bvp4c(@f,@bcs,solinit,[],Z); figure; p1 = plot( sol.x, sol.y(1,:), '-bo' ); hold on; legend( [ p1 ], 'w(z)' ); grid on; title( [ 'Z = ', num2str(Z) ] ); %deval(sol,0.1) function [ v ] = guess(x) % GUESS - % v = [ 0.5; 0; ]; function [res] = bcs(ya,yb,P,Z) % BCS - % res = [ ya(1)-1; yb(1)+(P(1)*sqrt(pi)/2)*erfc(Z); yb(2)-P(1)*exp(-Z^2); ]; function [ ode ] = f(x,y,P,Z) % F - % y(1)=w(z); y(2)=w'(z); % alpha = 0.8; ode = [ y(2); -( 2*x/sqrt( 1-alpha*y(1) ) )*y(2); ];