% 作成した信号に対し振幅と位相差を推定

T = 0.001;
A = 2.0;
f = 5;
d = pi/6;
alpha = 1.2; % 一様乱数 U(-alpha,alpha)

%%%%%

for tend = [ 1 2 5 10 20 50 100 ]
    time = (0:T:tend)';
    signal =  sinusoidal_with_noise ( time, A, f, d, alpha, 0 ); % 信号を作成
    [ square_error, amplitude, phase ] = estimate_amplitude_phase ( time, signal, f ); % 振幅と位相差を推定
    fprintf('tend = %f     amplitude = %f     phase = %f     error = %f\n', tend, amplitude, phase, square_error);
end
