% Script file to demonstrate a stiff system.
%
% Ian Mitchell for CS 403, 1/03/04

% ODE for a stiff system
f = inline('100 * (1 - y)', 't', 'y');

% Poor method.
nonstiffSolver = @ode45;

% Stiff method.
stiffSolver = @ode15s;

% Get a phase plane plot during execution.
options = odeset('OutputFcn', @odeplot);

% Demonstrate each solver.
figure;
[ ts, ys ] = feval(nonstiffSolver, f, [ 0 100 ], [ 0 ], options);
zoom on;
pause;

% Demonstrate each solver.
figure;
[ ts, ys ] = feval(stiffSolver, f, [ 0 100 ], [ 0 ], options);
zoom on;
