comparison m-toolbox/classes/@ao/ltfe.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % LTFE implements transfer function estimation computed on a log frequency axis.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: LTFE implements transfer function estimation computed on a
5 % log frequency axis. The estimate is done by taking
6 % the ratio of the CPSD between the two inputs, Sxy, divided by
7 % the PSD of the first input, Sxx:
8 % Sxy / Sxx where x is the first input, y is the second input
9 %
10 % CALL: b = ltfe(a1,a2,pl)
11 %
12 % INPUTS: a1 - input analysis object
13 % a2 - input analysis object
14 % pl - input parameter list
15 %
16 % OUTPUTS: b - output analysis object
17 %
18 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'ltfe')">Parameters Description</a>
19 %
20 % VERSION: $Id: ltfe.m,v 1.29 2011/04/08 08:56:16 hewitson Exp $
21 %
22 % References: "Improved spectrum estimation from digitized time series
23 % on a logarithmic frequency axis", Michael Troebs, Gerhard Heinzel,
24 % Measurement 39 (2006) 120-129.
25 %
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27
28 function varargout = ltfe(varargin)
29
30 % Check if this is a call for parameters
31 if utils.helper.isinfocall(varargin{:})
32 varargout{1} = getInfo(varargin{3});
33 return
34 end
35
36 import utils.const.*
37 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
38
39 if nargout == 0
40 error('### tfe cannot be used as a modifier. Please give an output variable.');
41 end
42
43 % Collect input variable names
44 in_names = cell(size(varargin));
45 for ii = 1:nargin,in_names{ii} = inputname(ii);end
46
47 % Collect all AOs
48 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names);
49
50 % Apply defaults to plist
51 pl = applyDefaults(getDefaultPlist, varargin{:});
52
53 % Throw an error if input is not two AOs
54 if numel(as) ~= 2
55 error('### ltfe only accepts two inputs AOs.');
56 end
57
58 % Compute transfer function with lxspec
59 bs = ao.lxspec(as, pl, 'tfe', getInfo, ao_invars);
60
61 % Set output
62 varargout{1} = bs;
63
64 end
65
66 %--------------------------------------------------------------------------
67 % Get Info Object
68 %--------------------------------------------------------------------------
69 function ii = getInfo(varargin)
70 if nargin == 1 && strcmpi(varargin{1}, 'None')
71 sets = {};
72 pl = [];
73 else
74 sets = {'Default'};
75 pl = getDefaultPlist();
76 end
77 % Build info object
78 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: ltfe.m,v 1.29 2011/04/08 08:56:16 hewitson Exp $', sets, pl);
79 ii.setModifier(false);
80 ii.setArgsmin(2);
81 end
82
83 %--------------------------------------------------------------------------
84 % Get Default Plist
85 %--------------------------------------------------------------------------
86 function plout = getDefaultPlist()
87 persistent pl;
88 if ~exist('pl', 'var') || isempty(pl)
89 pl = buildplist();
90 end
91 plout = pl;
92 end
93
94 function pl = buildplist()
95
96 % General plist for Welch-based, log-scale spaced spectral estimators
97 pl = plist.LPSD_PLIST;
98
99 end
100
101
102 % PARAMETERS:
103 %
104 % 'Kdes' - desired number of averages [default: 100]
105 % 'Jdes' - number of spectral frequencies to compute [default: 1000]
106 % 'Lmin' - minimum segment length [default: 0]
107 % 'Win' - the window to be applied to the data to remove the
108 % discontinuities at edges of segments. [default: taken from
109 % user prefs]
110 % Only the design parameters of the window object are
111 % used. Enter either:
112 % - a specwin window object OR
113 % - a string value containing the window name
114 % e.g., plist('Win', 'Kaiser', 'psll', 200)
115 % 'Olap' - segment percent overlap [default: -1, (taken from window function)]
116 % 'Order' - order of segment detrending
117 % -1 - no detrending
118 % 0 - subtract mean [default]
119 % 1 - subtract linear fit
120 % N - subtract fit of polynomial, order N
121 % 'Variance' - computes transfer function variance.
122 % 'yes' - compute tf variance [default]
123 % 'no' - do not compute tf variance