How to find the period of two overlapping series of pulses ?
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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:
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!