x=0:0.1:10;
[X2,X3]=meshgrid(x,x);
X1=X2;
S=(X1-5).^2+(X2-5).^2+(X3-3)^2;

M=[1; -1; 0]
[Q,R]=qr(M)
Z=Q(:,2:3)
H=[2 0 0;0 2 0;0 0 2]
Hp=Z'*H*Z

d=2*[2;3;1]
dp=Z*(Z'*d)

surf(X1,X2,X3); set(gca(),"auto_clear","off");
xlabel("x1"); ylabel("x2"); zlabel("x3");
param3d1([0;d(1)],[0;d(2)],list([0;d(3)],5));
param3d1([0;dp(1)],[0;dp(2)],list([0;dp(3)],3));
param3d1([d(1);dp(1)],[d(2);dp(2)],list([d(3);dp(3)],2));
