Created
April 16, 2012 18:19
-
-
Save ferryzhou/2400481 to your computer and use it in GitHub Desktop.
Automatically generate a threshold for a vector. Can be used to filter out noise.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function t = get_threshold(v) | |
% pitch the lowest 20% | |
[m, inds] = sort(v); | |
P = fix(0.2 * length(v)); | |
nt = m(P); | |
P = fix(0.8 * length(v)); | |
nt2 = m(P); | |
t = nt + 0.3 * (nt2 - nt); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment