%
%  code27.m -- boundary-layer test code
%
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

global alpha epsil
alpha = 0.25;  epsil = 0.06;

%  ODE file, max time, method & options
Xode = 'code27a';  T = 1; T0 = 0.0;  method = 'ode15s';  tol = 1e-6;

options = odeset('reltol',tol,'abstol',tol,'refine',1, ...
		'maxstep',T/20,'stats','off','events','off');
		
%  first solve
IV1 = [1 0];
[t1 y1] = feval(method,Xode,[T T0],IV1,options);

%  second solve
IV2 = [0 1];
[t2 y2] = feval(method,Xode,[T T0],IV2,options);

%  final solve
fact = (1-y1(end,1))/(y2(end,1));
IV3 = IV1 + fact*IV2;
[t3 y3] = feval(method,Xode,[T T0],IV3,options);

%subplot(2,1,1)
subplot(2,1,2)
plot(t3,y3(:,1),'r')
title(['\bf boundary-layer example (alpha=' num2str(alpha) ')'])
xlabel('\bf x-axis')
ylabel(['\bf y(x;\epsilon=' num2str(epsil) ')'])

