#!/usr/bin/env octave
load harmonic_regression.mat

A = [sin(x) cos(x) ones(size(x,1),1)];
L = -y;

X = -inv(A'*A)*(A'*L)

Amp = sqrt(sum(X(1:2).^2))
phi = atan2(X(2), X(1))
b   = X(3)

V = A*X + L;
A'*V
