%%%%%%%%%%%%%%%%%%%%%%
% experiment1 (p.64) %
%%%%%%%%%%%%%%%%%%%%%%

x = (-128:128)'/128;
A = [x.^0, x.^1, x.^2, x.^3];
[Q,R] = qr(A,0);

scale = Q(257,:);

H = Q*diag(1./scale);

t = -1:1/128:1;
figure(1)
subplot(211)
plot(t',Q)
grid on;
subplot(212)
plot(t',H)
grid on;

figure(2)
plot(t',H)
grid on;
legend('x^{0}','x','x^{2}','x^{3}' ,0);