Mercurial > hg > gccphat-windowing
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ab043bd3b162 |
---|---|
1 function [percHits]=percCorr(in,delay,err) | |
2 %calculate percentage of values in an array are within a defined value with | |
3 %an error | |
4 % Input: | |
5 % - in: vector to test | |
6 % - delay: correct value | |
7 % - err: error +/- | |
8 % | |
9 % Output: | |
10 % - percHits: percentage of correct values | |
11 % | |
12 % Developers: - Alice Clifford (alice.clifford@eecs.qmul.ac.uk) | |
13 | |
14 | |
15 y=zeros(length(in),1); | |
16 | |
17 for n=1:length(in); | |
18 | |
19 for k=-err:err | |
20 if in(n)==delay+k | |
21 y(n)=1; | |
22 end | |
23 end | |
24 end | |
25 | |
26 y=y(y==1); | |
27 | |
28 | |
29 numHits=length(y); | |
30 | |
31 percHits=(numHits/length(in))*100; |