% BCEdemo demonstrates the Backward Cauchy-Euler method % for solving the logistic ODE % % y' = y - y^2, y(0) = 0.1 % % on the interval [0 100]. % % Requires: BkEulerAuto.m, logde.m close all tspan = [0 100]; y0 = 0.1; [t,y] = BkEulerAuto('logde',tspan,y0); plot(t,y),grid axis([tspan(1) tspan(2) 0.98 1.02]) xlabel('t'), ylabel('y') title('Solution of logistic ODE') h = diff(t); figure semilogy(h'), grid xlabel('Step Number'), ylabel('Step Size') title('Stepsize history in solution of logistic ODE')