% Direction fields with MATLAB

% Define an inline function F of two variables t, y 
% corresponding to the right hand side of the differential equation 
% y'(t) = F(t,y(t)). E.g., for the differential equation 
% y'(t) = 8 - 3 y define

F = inline('8 - 3 .*y','t','y'); 

%To plot the direction field  for t going from t0 to t1 with a
%spacing of dt and y going from y0 to y1 with a spacing of dy use
%dirfield(g,t0:dt:t1,y0:dy:y1)  E.g., for
% t  between -2 and 1 with a spacing of 0.1
% and   y  between -20 and 40 with a spacing of 3 

dir_field(F,-2:0.1:1,-20:3:40);
 

 