%% Periods of Two-Channel Sinusoid
% Generate a two-channel sinusoid such that one channel has four periods in the sampling interval and the other channel has two periods. Plot the sinusoid.

n = 0:31;
x = cos(2*pi./[8;16].*n)';

plot(n,x,'.-')
axis tight

%
% Compute the lengths of the repeated subsequences and the number of repetitions. Specify an absolute tolerance of 1e-5.

[p,nr] = seqperiod(x,1e-5)

% Copyright 2019 The MathWorks, Inc.