tomwalters@0
|
1 % method of class @signal
|
tomwalters@0
|
2 %
|
tomwalters@0
|
3 % INPUT VALUES:
|
tomwalters@0
|
4 %
|
tomwalters@0
|
5 % RETURN VALUE:
|
tomwalters@0
|
6 %
|
tomwalters@0
|
7 %
|
bleeck@3
|
8 % This external file is included as part of the 'aim-mat' distribution package
|
bleeck@3
|
9 % (c) 2011, University of Southampton
|
bleeck@3
|
10 % Maintained by Stefan Bleeck (bleeck@gmail.com)
|
bleeck@3
|
11 % download of current version is on the soundsoftware site:
|
bleeck@3
|
12 % http://code.soundsoftware.ac.uk/projects/aimmat
|
bleeck@3
|
13 % documentation and everything is on http://www.acousticscale.org
|
bleeck@3
|
14
|
tomwalters@0
|
15
|
tomwalters@0
|
16 function [val,hoch,breit,widthvals]=qvalue(sig,where,howmuch)
|
tomwalters@0
|
17 % usage: val=qvalue(sig,where,howmuch)
|
tomwalters@0
|
18 % calculates the q-value, that is the hight divided by the width
|
tomwalters@0
|
19 % of the signal at a point given by where (in seconds!)
|
tomwalters@0
|
20 % howmuch is the indicator, how much the signal must be dropped 0.5 or such
|
tomwalters@0
|
21 % returns the width in seconds, or 0, when the signal does not reach the value
|
tomwalters@0
|
22 % widthvals has two x-values: where the width hits the signal
|
tomwalters@0
|
23
|
tomwalters@0
|
24 vals=sig.werte;
|
tomwalters@0
|
25 nr_bin=time2bin(sig,where);
|
tomwalters@0
|
26 nr_values=getnrpoints(sig);
|
tomwalters@0
|
27 howmuchdecrease=vals(nr_bin)*(1-howmuch); % value at the desired point
|
tomwalters@0
|
28 val=0;
|
tomwalters@0
|
29 hoch=0;
|
tomwalters@0
|
30 breit=0;
|
tomwalters@0
|
31 widthvals(1)=-inf;
|
tomwalters@0
|
32 widthvals(2)=inf;
|
tomwalters@0
|
33
|
tomwalters@0
|
34 int_time_up=nr_values+1;
|
tomwalters@0
|
35 for i=nr_bin:nr_values
|
tomwalters@0
|
36 if vals(i)< howmuchdecrease
|
tomwalters@0
|
37 int_time_up=i;
|
tomwalters@0
|
38 widthvals(1)=i;
|
tomwalters@0
|
39 break;
|
tomwalters@0
|
40 end
|
tomwalters@0
|
41 end
|
tomwalters@0
|
42
|
tomwalters@0
|
43 int_time_down=0;
|
tomwalters@0
|
44 for i=nr_bin:-1:1
|
tomwalters@0
|
45 if vals(i)< howmuchdecrease
|
tomwalters@0
|
46 int_time_down=i;
|
tomwalters@0
|
47 widthvals(2)=i;
|
tomwalters@0
|
48 break;
|
tomwalters@0
|
49 end
|
tomwalters@0
|
50 end
|
tomwalters@0
|
51
|
tomwalters@0
|
52 if int_time_down==0 | int_time_up==nr_values
|
tomwalters@0
|
53 hoch=vals(nr_bin);
|
tomwalters@0
|
54 breit=1000000;
|
tomwalters@0
|
55 val=hoch/breit;
|
tomwalters@0
|
56 widthvals(1)=0; widthvals(2)=0;
|
tomwalters@0
|
57 return;
|
tomwalters@0
|
58 end
|
tomwalters@0
|
59
|
tomwalters@0
|
60 time_up=bin2time(sig,int_time_up);
|
tomwalters@0
|
61 time_down=bin2time(sig,int_time_down);
|
tomwalters@0
|
62
|
tomwalters@0
|
63 hoch=vals(nr_bin);
|
tomwalters@0
|
64 breit=time_up-time_down;
|
tomwalters@0
|
65 if breit>0
|
tomwalters@0
|
66 val=hoch/breit;
|
tomwalters@0
|
67 else
|
tomwalters@0
|
68 vals=0;
|
tomwalters@0
|
69 end
|
tomwalters@0
|
70
|
tomwalters@0
|
71
|
tomwalters@0
|
72
|
tomwalters@0
|
73
|