x1=linspace(-4,4,100);
x2=linspace(-4,4,100);
[X1,X2]=meshgrid(x1,x2);


clf 
H=[1 0 ; 0 1];
c=[0 0];
c0=0;
%figure(1), clf
subplot(2,3,1)
y=1/2*H(1,1)*X1.^2+1/2*H(2,2)*X2.^2+H(1,2)*X1.*X2 + c(1)*X1+c(2)*X2+c0;
mesh(X1,X2,y)
title('Two positive eigenvalues')
rotate3d


H=[-1 0 ; 0 -1];
c=[0 0];
c0=0;
subplot(2,3,2)
%figure(2), clf
y=1/2*H(1,1)*X1.^2+1/2*H(2,2)*X2.^2+H(1,2)*X1.*X2 + c(1)*X1+c(2)*X2+c0;
mesh(X1,X2,y)
title('Two negative eigenvalues')
rotate3d


H=[1 0 ; 0 -1];
c=[0 0];
c0=0;
subplot(2,3,3)
%figure(3), clf
y=1/2*H(1,1)*X1.^2+1/2*H(2,2)*X2.^2+H(1,2)*X1.*X2 + c(1)*X1+c(2)*X2+c0;
mesh(X1,X2,y)
title('One positive and one negative eigenvalue')
rotate3d



H=[1 0 ; 0 0];
c=[0 0];
c0=0;
subplot(2,3,4)
%figure(4), clf
y=1/2*H(1,1)*X1.^2+1/2*H(2,2)*X2.^2+H(1,2)*X1.*X2 + c(1)*X1+c(2)*X2+c0;
mesh(X1,X2,y)
title('One positive and one zero eigenvalue')
rotate3d

H=[1 0 ; 0 0];
c=[1 0];
c0=0;
subplot(2,3,5)
%figure(5), clf
y=1/2*H(1,1)*X1.^2+1/2*H(2,2)*X2.^2+H(1,2)*X1.*X2 + c(1)*X1+c(2)*X2+c0;
mesh(X1,X2,y)
title('One positive and one zero eigenvalue, tilted along constant direction')
rotate3d


H=[1 0 ; 0 0];
c=[0 1];
c0=0;
subplot(2,3,6)
%figure(6), clf
y=1/2*H(1,1)*X1.^2+1/2*H(2,2)*X2.^2+H(1,2)*X1.*X2 + c(1)*X1+c(2)*X2+c0;
mesh(X1,X2,y)
title('One positive and one zero eigenvalue, tilted')
rotate3d








