% Peer Training: Intermediate MATLAB % SCRIPT FILE: symbolic_ode.m % Written by Omar Lakkis % Last updated 02/15/00 clear % Compute firs the symbolic solution sym_solution = dsolve('Dy = t + y', 'y(t0)=y0','t'); % Transform the symbolic solution into a MATLAB function fun_solution = inline(vectorize(sym_solution),'t','t0','y0'); % Exploit it to draw families of solutions: figure; axes; hold on; for c = -2:.5:3 t = 0:0.1:1.5; plot(t,fun_solution(t,0,c)) text(1.5,fun_solution(1.5,0,c),mat2str(c)) end grid on