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

3 ビュー (過去 30 日間)
Phil Lee
Phil Lee 2020 年 3 月 20 日
回答済み: Samatha Aleti 2020 年 3 月 27 日
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

回答 (1 件)

Samatha Aleti
Samatha Aleti 2020 年 3 月 27 日
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

カテゴリ

Help Center および File ExchangeArray and Matrix Mathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by