function demo_hp_fitting2()
a1=input('a1:');
a2=input('a2:');
a3=input('a3:');
n=100;
X=rand(2,n)*2*pi-pi;
y=log([a1 a2]*X+a3+rand(1,n)*0.3-0.15);
plot3(X(1,:),X(2,:),y,'.');
X=[X' ones(n,1)];
b=y';
a=inv(X'*X)*X'*b
ss=sprintf('%f * x1 + %f *x2 +%f',a(1),a(2),a(3));
hold on
plot2d(ss);
return
function plot2d(fstr)
fx=inline(fstr);
range=pi;
x1=-range:0.1:range;
x2=x1;
for i=1:length(x1)
        C(i,:)=fx(x1(i),x2);
end
mesh(x1,x2,C);
return
