How to find the period of two overlapping series of pulses ?

3 vues (au cours des 30 derniers jours)
Phil Lee
Phil Lee le 20 Mar 2020
I have two series of pulses of the same amplitude but one has a period of 3 seconds and the other a period of 4 seconds.
As a result of have the pulses at the following times:
0, 3, 4, 6, 8, 9, 12, 15, 16, 18, 20, 21 etc
Is there a way to get Matlab to determine the two periods i.e. 3 seconds and 4 seconds ? I used Matlab a long, long time ago (over 20 years, sheesh !) and I'll looking to use if for a personal project. I've got the DSP and Signal Processing toolboxes.
And is the method scalable so that it can more series (possibly up to 10) ?
Thanks in advance

Réponses (1)

Samatha Aleti
Samatha Aleti le 27 Mar 2020
Hi,
As per my understanding you are trying to find at what different increments(least possible) the sequence is generated. You can find this by taking a range of numbers and checking if the sequence contains all its multiples according to the sequence length. Here is a sample code:
x = [0, 3, 4, 6, 8, 9, 12, 15, 16, 18, 20, 21];
Range = [1:10]'; % Range
period = zeros(length(Range),1); % Initialize output value
startSeq = 0; % Starting number of sequence
for i = 1:length(Range)
% Check if this number is already included or counted in other series
if ~any((mod(Range(i), period(period>0)) == 0))
series = x(rem(x, Range(i)) == 0); % All multiples present in the sequence
l = length(series);
if l > 1
mul = Range(i) * [startSeq:l-1];
if all(ismember(mul,series)) % Check if all multiples are present in the sequence
period(i) = Range(i);
end
end
end
end
period = period(period>0)
Also, following are some similar functions that you can refer:
seqperiod to find the period of repeating sequence
pulseperiod to find period of bilevel pulse

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by