Mercurial > hg > ltpda
comparison m-toolbox/classes/@matrix/psd.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 % PSD computes the PSD of the time-series in a matrix object. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: PSD computes the PSD of the time-series in a matrix object. | |
5 % | |
6 % CALL: out = psd(in,pl); | |
7 % | |
8 % Note: this is just a wrapper of ao/psd. Each AO in the matrix is passed | |
9 % to split with the input plist. | |
10 % | |
11 % INPUTS: in - input matrix objects | |
12 % pl - parameter list | |
13 % | |
14 % OUTPUTS: out - output matrix objects | |
15 % | |
16 % <a href="matlab:utils.helper.displayMethodInfo('matrix', 'psd')">Parameters Description</a> | |
17 % | |
18 % VERSION: $Id: psd.m,v 1.1 2011/08/24 07:29:48 hewitson Exp $ | |
19 % | |
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
21 | |
22 function varargout = psd(varargin) | |
23 | |
24 % Check if this is a call for parameters | |
25 if utils.helper.isinfocall(varargin{:}) | |
26 varargout{1} = getInfo(varargin{3}); | |
27 return | |
28 end | |
29 | |
30 if nargout == 0 | |
31 error('### Matrix psd method can not be used as a modifier.'); | |
32 end | |
33 | |
34 % Collect input variable names | |
35 in_names = cell(size(varargin)); | |
36 for ii = 1:nargin | |
37 in_names{ii} = inputname(ii); | |
38 end | |
39 | |
40 % Collect all smodels and plists | |
41 [ms, matrix_invars, rest] = utils.helper.collect_objects(varargin(:), 'matrix', in_names); | |
42 [pl, pl_invars, rest] = utils.helper.collect_objects(varargin(:), 'plist', in_names); | |
43 | |
44 % call the matrix wrapper | |
45 varargout{1} = wrapper(ms, pl, getInfo('None'), in_names, 'psd'); | |
46 | |
47 end | |
48 | |
49 | |
50 | |
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
52 % Local Functions % | |
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
54 | |
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
56 % | |
57 % FUNCTION: getInfo | |
58 % | |
59 % DESCRIPTION: Get Info Object | |
60 % | |
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
62 | |
63 function ii = getInfo(varargin) | |
64 | |
65 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
66 sets = {}; | |
67 pls = []; | |
68 else | |
69 ii = ao.getInfo('split'); | |
70 sets = ii.sets; | |
71 pls = []; | |
72 for kk=1:numel(sets) | |
73 pls = [pls getDefaultPlist(sets{kk})]; | |
74 end | |
75 end | |
76 % Build info object | |
77 ii = minfo(mfilename, 'matrix', 'ltpda', utils.const.categories.aop, '$Id: psd.m,v 1.1 2011/08/24 07:29:48 hewitson Exp $', sets, pls); | |
78 ii.setArgsmin(2); | |
79 ii.setModifier(false); | |
80 end | |
81 | |
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
83 % | |
84 % FUNCTION: getDefaultPlist | |
85 % | |
86 % DESCRIPTION: Get Default Plist | |
87 % | |
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
89 | |
90 %-------------------------------------------------------------------------- | |
91 % Get Default Plist | |
92 %-------------------------------------------------------------------------- | |
93 function plout = getDefaultPlist(set) | |
94 persistent pl; | |
95 persistent lastset; | |
96 if exist('pl', 'var')==0 || isempty(pl) || ~strcmp(lastset, set) | |
97 pl = buildplist(set); | |
98 lastset = set; | |
99 end | |
100 plout = pl; | |
101 end | |
102 | |
103 function pl = buildplist(set) | |
104 | |
105 ii = ao.getInfo('psd', set); | |
106 pl = ii.plists(1); | |
107 | |
108 end |