Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/lcpsd.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 % LCPSD implement cross-power-spectral density estimation on a log frequency axis. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: LCPSD implement cross-power-spectral density estimation on a | |
5 % log frequency axis | |
6 % | |
7 % CALL: b = lcpsd(a1,a2,pl) | |
8 % | |
9 % INPUTS: aN - input analysis objects (two) | |
10 % pl - input parameter list | |
11 % | |
12 % OUTPUTS: b - output analysis object | |
13 % | |
14 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'lcpsd')">Parameters Description</a> | |
15 % | |
16 % VERSION: $Id: lcpsd.m,v 1.29 2011/04/08 08:56:13 hewitson Exp $ | |
17 % | |
18 % References: "Improved spectrum estimation from digitized time series | |
19 % on a logarithmic frequency axis", Michael Troebs, Gerhard Heinzel, | |
20 % Measurement 39 (2006) 120-129. | |
21 % | |
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
23 | |
24 function varargout = lcpsd(varargin) | |
25 | |
26 % Check if this is a call for parameters | |
27 if utils.helper.isinfocall(varargin{:}) | |
28 varargout{1} = getInfo(varargin{3}); | |
29 return | |
30 end | |
31 | |
32 import utils.const.* | |
33 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename); | |
34 | |
35 if nargout == 0 | |
36 error('### lcpsd cannot be used as a modifier. Please give an output variable.'); | |
37 end | |
38 | |
39 % Collect input variable names | |
40 in_names = cell(size(varargin)); | |
41 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
42 | |
43 % Collect all AOs | |
44 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); | |
45 | |
46 % Apply defaults to plist | |
47 pl = applyDefaults(getDefaultPlist, varargin{:}); | |
48 | |
49 % Throw an error if input is not two AOs | |
50 if numel(as) ~= 2 | |
51 error('### lcpsd only accepts two inputs AOs.'); | |
52 end | |
53 | |
54 % Compute cross-spectrum with lxspec | |
55 bs = ao.lxspec(as, pl, 'cpsd', getInfo, ao_invars); | |
56 | |
57 % Set output | |
58 varargout{1} = bs; | |
59 | |
60 end | |
61 | |
62 %-------------------------------------------------------------------------- | |
63 % Get Info Object | |
64 %-------------------------------------------------------------------------- | |
65 function ii = getInfo(varargin) | |
66 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
67 sets = {}; | |
68 pl = []; | |
69 else | |
70 sets = {'Default'}; | |
71 pl = getDefaultPlist(); | |
72 end | |
73 % Build info object | |
74 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: lcpsd.m,v 1.29 2011/04/08 08:56:13 hewitson Exp $', sets, pl); | |
75 ii.setModifier(false); | |
76 ii.setArgsmin(2); | |
77 end | |
78 | |
79 %-------------------------------------------------------------------------- | |
80 % Get Default Plist | |
81 %-------------------------------------------------------------------------- | |
82 function plout = getDefaultPlist() | |
83 persistent pl; | |
84 if ~exist('pl', 'var') || isempty(pl) | |
85 pl = buildplist(); | |
86 end | |
87 plout = pl; | |
88 end | |
89 | |
90 function pl = buildplist() | |
91 | |
92 % General plist for Welch-based, log-scale spaced spectral estimators | |
93 pl = plist.LPSD_PLIST; | |
94 | |
95 end | |
96 |