x=-1.5:.02:1.5;
y=-.8:.02:.8;
[x,y]=meshgrid(x,y);
% genererar matriser med x- och y-varden
z=2*(x.^2-y.^2)-(x.^2+y.^2).^2;
mesh(x,y,z)
% ytan
figure
contour(x,y,z,30)
% nivakurvor
x=-5:.02:5;
[x y]=meshgrid(x,x);
% dito
z=sin(x+y);
figure
mesh(x,y,z)




