function testode y0 = 1; [T Y] = ode45(@frhs, [0 2], y0); y = ftrue(T); subplot(311); plot(T,Y); title('Approximate Solution'); subplot(312); plot(T,y); title('True Solution'); subplot(313); plot(T, abs(Y-y)); title('Approximate Error'); end %function %subfunctions function f = frhs(t,y) f = t-y; end %function function f = ftrue(t) f = 2*exp(-t) + t - 1; end %function