Matlab illustrate stiffness

% matlab script to illustrate stiffness 
% using simple flame propagation model

close all
clear all

% define the right-hand side of the ODE
F = inline('y^2 - y^3','t','y');

delta = 0.01; % not stiff
tic
ode23(F,[0 2/delta],delta);
toc
disp('Press any key to continue.')
pause

% try again, this time with stiffness ...
delta = 0.0001;
tic
ode23(F,[0 2/delta],delta);
toc
disp('Press any key to continue.')
pause

% now use a stiff solver to solve the problem
tic
ode23s(F,[0 2/delta],delta);
toc
posted @ 2015-03-28 07:44  vigorpush  阅读(196)  评论(0)    收藏  举报