%% Sinusoid Amplitudes
% Estimate the amplitudes for two sinusoids in noise. The separation between the sinusoids is less than the resolution of the periodogram, 2\pi/N radians/sample. Use the autocorrelation matrix as the input to rootmusic.

rng default
n = (0:99)';
frqs = [pi/4 pi/4+0.06];

s = 2*exp(1j*frqs(1)*n)+1.5*exp(1j*frqs(2)*n)+ ...
    0.5*randn(100,1)+1j*0.5*randn(100,1);

[~,R] = corrmtx(s,12,'mod');
[W,P] = rootmusic(R,2,'corr')

% Copyright 2015 The MathWorks, Inc.