function [ ] = prob_2_13 % % Written by: % -- % John L. Weatherwax 2005-05-07 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- nTs = 10; a = 1; b = 10; ts = linspace( a, b, nTs ); [ts,ys] = ode45(@f,ts,1); figure; plot( ts, 1./ts, '-og' ); plot( ts, ys, '-or' ); title( 'ODE45 Solution' ); [ts,ys] = ode15s(@f,ts,1); figure; plot( ts, 1./ts, '-og' ); plot( ts, ys, '-or' ); title( 'ODE15S Solution' ); return; function [dydt] = f(t,y) dydt = -1/(t^2) + 10*(y-(1/t)); return;