function Z=quadplot(A,b,x,y);
% quadplot(A,b,x,y) plots  x'*A*x+b'*x for x=[x(i);y(j)]

Z=zeros(length(x),length(y));

for i=1:length(x)
  for j=1:length(y)
     v=[x(i); y(j)];
     Z(i,j)=v'*A*v+b'*v;
  end
end

figure(1);
hold off;
mesh(x,y,Z);

figure(2);
hold off
contour(x,y,Z);     % plot the function

