Clear Filters
Clear Filters

Find close values in N vectors an get the number of appearances

1 view (last 30 days)
I have N (4 or more) vectors with frequencies of the peaks of a FFT, i found the peaks with "findpeaks". I need to find the peaks the vectors have in common. They have not the exact same value, so there is a small deviation possible since the FFT's have a limited resolution. The "intersect"-command does not work because of this. Is it possible to find a solution, which gives the number of Vectors with matchting fequencies and the value of the frequency or its position number in the vector. One of the problems is, that you have to check all possible orders (permutations) while checking if one vector-value is close to any value of another vector. i.e. every vector has only one entry (hardly a vector, i know... but for the sake of simplicity)
V1=4
V2=4.1
V3=4.2
V4=23
the maximum deviation is
e=0.1
If i start with V1 only V2 is within the range of e. If you start with V2, V1 and V3 are in the range.
I hope my description is sufficient, i have no real code example that comes close to a solution. I hope you guys have a simple one.
Thanks Max

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!