function yournameDIRfieldVectzd(fnct, It, Iy)
% fnct: RHS of first order DE function representing directin fields(think about it)
% It: time interval, tmin, tmax, 
% Iy: y interval of ymin and ymax to be enjoyed. 
% Example: 
%	fnt=@(v_ u_) v_.^2-u_.^2; 
%	yournameDIRfiledVectzd(fnt, [-2 2], [-4 4])
%
% funn = @(x_,y_) x_.*y_.^2;
% funn = @(x_,y_) x_.^2./y_.^2;
% funn = @(x_,y_) x_./y_; 
% funn = @(x_,y_) x_./(y_+.01);

if (~diff(It)|~diff(Iy))
	disp(sprintf('One of the intervals you entered is zero!, quiting'));
	return;
end
num=20;
xh=(It(2)-It(1))/num;      
yh=(Iy(2)-Iy(1))/num;
[xm,ym] = meshgrid(It(1):xh:It(2),Iy(1):yh:Iy(2));
	
scalefactor=1/25*(It(end)-It(1));
slopes=fnct(xm,ym);
figure;
subplot(2,2,1), imagesc(slopes); %slopes not normalized
rr=sqrt(1+slopes.^2);
dxx=(1./rr)*scalefactor;
dyy=(slopes./rr)*scalefactor;
% normilized slopes
subplot(2,2,2), imagesc(dyy); %image like contour
subplot(2,2,3), mesh(dyy);% 3d mesh view
axis tight
subplot(2,2,4), quiver(xm,ym,dxx,dyy,0); % Here is the direction field
axis tight
hold on

disp(sprintf('Enter an interval of particular sltn I0 and IEnd, ie [2 3]'));
disp(sprintf('Note you must avoid discontinuities otherwise ade45 will go infinite loop'));
It=input('         It ='); 
disp(sprintf('Enter t0, IF IT doesnt return a plot enter cntC to return prompt line'));
t0=input('         t0='); 

% the point t0 willnot return a value. valid interval, 
[px,py]=ode45(fnct,It,t0);
plot(px,py,'r'); 
hold off
