Mercurial > hg > camir-aes2014
comparison toolboxes/MIRtoolbox1.3.2/MIRToolbox/combinepeaks.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function c = combinepeaks(p,v,thr) | |
2 % dedicated function for (Klapuri, 99) that creates a curve made of burst | |
3 % at position of peaks p and with amplitude related to peaks v. | |
4 | |
5 dp = get(p,'Data'); | |
6 dv = get(v,'Data'); | |
7 pp = get(p,'PeakPos'); | |
8 pv = get(v,'PeakPos'); | |
9 sr = get(v,'Sampling'); | |
10 l = length(dp); | |
11 empty = cell(1,l); | |
12 for i = 1:l | |
13 thr = round(thr*sr{i}); | |
14 empty{i} = cell(1,length(dp{i})); | |
15 for h = 1:length(dp{i}) | |
16 dih = zeros(size(dp{i}{h})); | |
17 for l = 1:size(pp{i}{h},3) | |
18 for k = 1:size(pp{i}{h},2) | |
19 j = 1; | |
20 ppkl = pp{i}{h}{1,k,l}; | |
21 pvkl = pv{i}{h}{1,k,l}; | |
22 while j < length(ppkl) | |
23 if ppkl(j+1)-ppkl(j) < thr | |
24 decreas = dv{i}{h}(pvkl(j+1),k,l) ... | |
25 < dv{i}{h}(pvkl(j),k,l); | |
26 ppkl(j+decreas) = []; | |
27 pvkl(j+decreas) = []; | |
28 else | |
29 j = j+1; | |
30 end | |
31 end | |
32 dih(ppkl,k,l) = dv{i}{h}(pvkl,k,l); | |
33 end | |
34 end | |
35 dv{i}{h} = dih; | |
36 end | |
37 end | |
38 c = set(p,'Data',dv,'PeakPos',empty,'PeakVal',empty,... | |
39 'PeakPrecisePos',{},'PeakPreciseVal',{},'PeakMode',empty,... | |
40 'InterChunk',[]); |