% Load the observations
load observations.mat

% Define the dependent time variable
Ax1 = [ones(20,1) t_obs t_obs .^2] ;
Ay1 = Ax1 ;
Ax2 = [ones(20,1) t_obs t_obs .^2 t_obs .^3] ;
Ay2 = Ax2 ;
Ax3 = [ones(20,1) sin(2*pi*t_obs/360) cos(2*pi*t_obs /360)] ;
Ay3 = Ax3 ;

% Define the independent coordinates variables
bx1 = x_obs'; 
by1 = y_obs';
bx2 = x_obs';
by2 = y_obs';
bx3 = x_obs';
by3 = y_obs';

% Call your least squares function
cx1 = leastSquares(Ax1, bx1)' ;
cy1 = leastSquares(Ay1, by1)' ;
cx2 = leastSquares(Ax2, bx2)' ;
cy2 = leastSquares(Ay2, by2)' ;
cx3 = leastSquares(Ax3, bx3)' ;
cy3 = leastSquares(Ay3, by3)' ;

% Run the test models functions to test your model
test_models('f1', 'f1', cx1, cy1)
test_models('f2', 'f2', cx2, cy2)
test_models('f3', 'f3', cx3, cy3)

