% Plot the vector fields for three different ODE's close all clear all %*** y'(t) = y(t) --> y(t) = exp(t) + y0 tmax = 5; ymax = 5; tVec = linspace(0,tmax,10); yVec = linspace(0,ymax,10); tPlot =linspace(0,tmax,101); f = @(t,y) 0.5*y; figure(1) % plot the vectorfield using the vectors tVec an yVec ylim([0,ymax]); xlim([0,tmax]) title('y(t) = 0.5*y(t)') %*** y'(t) = y^2+t^2 tmax = 2; ymax = 3; tVec = linspace(0,tmax,10); yVec = linspace(0,ymax,10); tPlot =linspace(0,tmax,101); % define function f figure(2) % plot vectorfield ylim([0,ymax]); xlim([0,tmax]) title('y(t) = y^2+t^2') %*** y'(t) = (5-5*y).*y tmax = 2; ymax = 2; tVec = linspace(0,tmax,10); yVec = linspace(0,ymax,10); tPlot =linspace(0,tmax,101); % define function f figure(3) % plot vectorfield ylim([0,ymax]); xlim([0,tmax]) title('y(t) = (5-5*y).*y')