Mercurial > hg > gccphat-windowing
diff Functions/percCorr.m @ 0:ab043bd3b162 tip
First commit
author | Alice Clifford <alice.clifford@eecs.qmul.ac.uk> |
---|---|
date | Mon, 11 Jun 2012 17:42:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Functions/percCorr.m Mon Jun 11 17:42:13 2012 +0100 @@ -0,0 +1,31 @@ +function [percHits]=percCorr(in,delay,err) +%calculate percentage of values in an array are within a defined value with +%an error +% Input: +% - in: vector to test +% - delay: correct value +% - err: error +/- +% +% Output: +% - percHits: percentage of correct values +% +% Developers: - Alice Clifford (alice.clifford@eecs.qmul.ac.uk) + + +y=zeros(length(in),1); + +for n=1:length(in); + + for k=-err:err + if in(n)==delay+k + y(n)=1; + end + end +end + +y=y(y==1); + + +numHits=length(y); + +percHits=(numHits/length(in))*100;