% Test Script P2
% Checks out TrigLS

randn('seed',0)
clc
close all
m = 400;
P = 2.4;
tau = linspace(0,10,m)';
f = 1 - 1./(2 + sin(3*tau) + .3* cos(5*tau));

% Example 1
n = 5
[alfa,beta,gamma,Predict] = TrigLS(tau,f,P,n);
plot(tau,f,'k',tau,Predict,'r')
format long
clc
alfa = alfa
beta = beta
gamma = gamma

% Example 2
n = 100;
[alfa,beta,gamma,Predict] = TrigLS(tau,f,P,n);
figure
plot(tau,f,'k',tau,Predict,'r')