Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/ifft.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 % IFFT overloads the ifft operator for Analysis objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: IFFT overloads the ifft operator for Analysis objects. | |
5 % | |
6 % CALL: b = ifft(a, pl) | |
7 % | |
8 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'ifft')">Parameters Description</a> | |
9 % | |
10 % VERSION: $Id: ifft.m,v 1.31 2011/04/28 21:31:31 mauro Exp $ | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 | |
14 function varargout = ifft(varargin) | |
15 | |
16 % Check if this is a call for parameters | |
17 if utils.helper.isinfocall(varargin{:}) | |
18 varargout{1} = getInfo(varargin{3}); | |
19 return | |
20 end | |
21 | |
22 import utils.const.* | |
23 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename); | |
24 | |
25 % Collect input variable names | |
26 in_names = cell(size(varargin)); | |
27 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
28 | |
29 % Collect all AOs and plists | |
30 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); | |
31 | |
32 % Decide on a deep copy or a modify | |
33 bs = copy(as, nargout); | |
34 | |
35 % Apply defaults to plist | |
36 pl = applyDefaults(getDefaultPlist, varargin{:}); | |
37 | |
38 % two-sided or one? | |
39 type = find(pl, 'type'); | |
40 | |
41 % scale? | |
42 scale = utils.prog.yes2true(find(pl, 'scale')); | |
43 | |
44 % Check input analysis object | |
45 for jj = 1:numel(bs) | |
46 | |
47 % call core method of the fft | |
48 bs(jj).ifft_core(type); | |
49 if scale | |
50 bs(jj) = bs(jj)./ao(plist('vals',1/as(jj).fs,'yunits','Hz^-1')); | |
51 bs(jj).simplifyYunits(); | |
52 end | |
53 % Set name | |
54 bs(jj).name = sprintf('ifft(%s)', ao_invars{jj}); | |
55 % Add history | |
56 bs(jj).addHistory(getInfo('None'), pl, ao_invars, bs(jj).hist); | |
57 | |
58 end | |
59 | |
60 % Set output | |
61 varargout = utils.helper.setoutputs(nargout, bs); | |
62 end | |
63 | |
64 %-------------------------------------------------------------------------- | |
65 % Get Info Object | |
66 %-------------------------------------------------------------------------- | |
67 function ii = getInfo(varargin) | |
68 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
69 sets = {}; | |
70 pl = []; | |
71 else | |
72 sets = {'Default'}; | |
73 pl = getDefaultPlist(); | |
74 end | |
75 % Build info object | |
76 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: ifft.m,v 1.31 2011/04/28 21:31:31 mauro Exp $', sets, pl); | |
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 pl = plist(); | |
93 | |
94 % Type | |
95 p = param({'type', 'Assume the data is symmetric or nonsymmetric.'}, {1, {'symmetric', 'nonsymmetric'}, paramValue.SINGLE}); | |
96 pl.append(p); | |
97 | |
98 % Scale by sample rate? | |
99 p = param({'scale',['set to ''true'' to scale FFT by sampling rate to match '... | |
100 'amplitude in continuous domain. Only applicable to data with sampel rates.']},... | |
101 paramValue.FALSE_TRUE); | |
102 pl.append(p); | |
103 | |
104 end | |
105 |