%
% SHOOTA.M Example of Shooting Method for Solving 2-Point BVPs
% (Automated Iterative Procedure)
%
% This demo solves a particular 2nd order ODE using an iterative form of
% the shooting method. The variable ALF is chosen automatically as part of the
% iterative procedure. This is discussed as Example 5.1 Case 2 Automated
% Iteration in the course notes for Math Methods (10/24.539).
%
% The goal is to find the value of the free parameter, ALF = y'(0) which,
% upon solution of the IVP, satisfies the desired boundary condition at x = pi.
% The automated algortithm for the Shooting Method is imlemented within the
% BVP2SH.M file.
%
% also see SHOOTF.M - contains description of given differential equation
% y'' + 3xy' + 7y = cos(2x) with y(0) = 1 and y(pi) = 0
%
% also see related files:
% SHOOTM1.M - solves same problem using a manual iterative scheme
% SHOOTM2.M - shows multiple curves of y(x) for different ALF (manual case)
%
% Files prepared by J. R. White, UMass-Lowell (Aug. 2003)
%
%
% getting started
clear all, close all
%
% set domain limits
xo = 0; xf = pi;
%
% set coefficients for BCs
zbc = [1 0 1.0; % left BC --> y(xo) = 1.0
1 0 0.0]; % right BC --> y(xf) = 0.0
%
% solution via Shooting Method (numerical approx)
tol = 1e-6; options = odeset('RelTol',tol); % set tight tolerance for ODE soln
[xs,zs] = bvp2sh('shootf',[xo xf],zbc,options);
%
% plot final function values
plot(xs,zs(:,1),'LineWidth',2),grid
title('ShootA: Shooting Method for ODEs (Case 2 - Automated Iteration)')
xlabel('x values'),ylabel('y values')
%
% end demo