%
% example 9.3  forward euler instability
%
a = 5;
h = [ 0.01 0.25 0.35 0.40 0.45 ];
tmax = 2;
%
for j = 1:length(h),
  clear x;
  x = 1;
  n = ceil( tmax / h(j) ) + 1;
  for i = 2:n,
    x(i) = x(i-1) * ( 1 - h(j) * a );
  end;
%
  if j > 1, hold on; end;
  plot( h(j)*(0:(n-1)), x );
end;
hold off;
%
axis( [ 0 2 -2 2 ] );
set( gca, 'fontsize', 16 );
sxlabel( '\20Time {\times \24 \it t}' );
sylabel( '\20Value of {\times \24 \it x(t)}' );
%
stext( 0.23, 0.40, '\20 {\times \24 \it h} = 0.01' );
stext( 0.05, -0.25, '\20 0.25' );
stext( 0.15, -0.75, '\20 0.35' );
stext( 0.20, -1.00, '\20 0.40' );
stext( 0.25, -1.25, '\20 0.45' );
%
printsto -f1 -deps2 ex9-3.eps
%

