p = seqperiod(x) returns
the integers that correspond to the periods of the sequences in x. The
period p is computed as the minimum length of a subsequence
x(1:p) of x that repeats itself continuously every
p samples.
The first column of x has period 2. The second column of x has period 1. The third column of x is not periodic, so p(3) is just the number of rows of x. The fourth column of x has period 3, although the second repetition of the periodic sequence is incomplete.
Compute the number of times that each periodic sequence is repeated.
[~,nr] = seqperiod(x)
nr = 1×4
2.0000 4.0000 1.0000 1.3333
In the first column of x, the periodic sequence appears twice. In the second column, the one-sample sequence is repeated as many times as there are samples. In the third column, there is no repetition. The number of repetitions in the fourth column is one plus the fraction of the sequence length represented by the remaining sample.
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.
Compute the period of the repeating sequence and the number of repetitions contained in the array. The function works along the third dimension, as expected.
Sequence period, returned as a scalar, vector, matrix, or N-D
array. If a sequence is not periodic, then p equals the length of
x along the chosen dimension.
If x is a matrix, then p is a row
vector with the same number of columns as x.
If x is a multidimensional array, then
p is a multidimensional array of integers whose first
dimension is of size 1. The remaining dimensions of p
correspond to the remaining dimensions of x with sizes larger
than 1.
Number of sequence repetitions, returned as a scalar, vector, matrix, or
N-D array. nr has the same dimensions as
p. The elements of nr are not necessarily
integers.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.