I have an audio data set in terms of frequency(Y axis) vs frame (X axis) and want to detect values above a threshold that also stays beyond the value for more than a particular interval of frames and repeat using a loop. Can someone help me with it?

1 view (last 30 days)
Frequency vs frame graph for 10 trials cross function to find point above trials? then also see if the value lies greater than the threshold for certain # of frames Looping for 10 set of 10 trials

Answers (1)

Carl
Carl on 25 Jul 2017
Hi Niveditha. You can do this by first determining which elements of your frequency data are above the threshold, and then searching for a sequence of such elements. The code below creates a random vector, and searches for a sequence of 2 elements that are above the threshold of 0.5:
y = rand(10,1)
above_thresh = y > 0.5
num_frames = 2;
match = ones(num_frames,1);
findsubmat(above_thresh, match)
It makes use of the findsubmat File Exchange function found here:
Let me know if this works for you.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!