clf
set(0,'defaulttextinterpreter','latex')
 
F1=@(x,y) y+2*x; F2=@(x,y) x;
x=linspace(-2,2,20);y=linspace(-2,2,21);
[X,Y]=meshgrid(x,y);
quiver(X,Y,F1(X,Y),F2(X,Y),1.5,'LineWidth',1.2)
hold on
axis([-2.5,2.5,-2.5,2.5])
axis equal
%set(gca,'YTickLabel',{})
% set(gca,'XTickLabel',{}) 
% set(gca,'ZTickLabel',{})
text(-.5,2.2,'$\mathbf{F}(x,y) = (y+2x) \mathbf{i} +x\mathbf{j}$','FontSize',14)

pause
s=-1:0.3:1;
streamline(stream2(X,Y,F1(X,Y),F2(X,Y),s,-2*s))
streamline(stream2(X,Y,F1(X,Y),F2(X,Y),s,-2.6*s))
%  [X,Y]=meshgrid(0:0.1:4,-2:.1:2);
%  falt=@(x,y) exp(x).*sin(y);
% Z=falt(X,Y);
% contour(X,Y,Z,[-24:3:-1 1:3:24],'k')
 te=text(-.5,-2.3,'F\"altlinjer','FontSize',14);
pause
x=linspace(-2,2,70);y=linspace(-2,2,71);
 pot=@(x,y) x.*y+x.^2;
 contour(X,Y,pot(X,Y),10,'r')
 delete(te)
 text(-.5,-2.3,'Ekvipotentialkurvor: $xy+x^2=C$','FontSize',14,'Color','r');
axis equal