comparison m-toolbox/classes/@matrix/fft.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 % FFT implements the fft operator for matrix objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: FFT implements the fft operator for matrix objects.
5 %
6 % CALL: out = fft(in,pl);
7 %
8 % INPUTS: in - input matrix objects
9 % pl - parameter list
10 %
11 % OUTPUTS: out - output matrix objects
12 %
13 % <a href="matlab:utils.helper.displayMethodInfo('matrix', 'fft')">Parameters Description</a>
14 %
15 % VERSION: $Id: fft.m,v 1.6 2011/04/08 08:56:31 hewitson Exp $
16 %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
19 function varargout = fft(varargin)
20
21 % Check if this is a call for parameters
22 if utils.helper.isinfocall(varargin{:})
23 varargout{1} = getInfo(varargin{3});
24 return
25 end
26
27 if nargout == 0
28 error('### Matrix fft operator can not be used as a modifier.');
29 end
30
31 % Collect input variable names
32 in_names = cell(size(varargin));
33 for ii = 1:nargin
34 in_names{ii} = inputname(ii);
35 end
36
37 % Collect all smodels and plists
38 [ms, matrix_invars, rest] = utils.helper.collect_objects(varargin(:), 'matrix', in_names);
39 [pl, pl_invars, rest] = utils.helper.collect_objects(varargin(:), 'plist', in_names);
40
41 % Merge with default plist
42 pl = parse(pl, getDefaultPlist);
43
44 % deep copy
45 mat = copy(ms,1);
46
47 n = numel(mat);
48
49 % loop over number of matrices
50 for ii = 1:n
51 % get size of object
52 [rw,cl] = size(mat(ii).objs);
53
54 % loop over raws and columns
55 for kk = 1:rw
56 for jj = 1:cl
57 mat(ii).objs(kk,jj) = fft(mat(ii).objs(kk,jj),pl);
58 end
59 end
60 mat(ii).addHistory(getInfo('None'), [], {inputname(1)}, [mat(ii).hist]);
61 end
62
63 varargout{1} = mat;
64
65 end
66
67
68
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 % Local Functions %
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 %
75 % FUNCTION: getInfo
76 %
77 % DESCRIPTION: Get Info Object
78 %
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80
81 function ii = getInfo(varargin)
82
83 if nargin == 1 && strcmpi(varargin{1}, 'None')
84 sets = {};
85 pls = [];
86 else
87 sets = {'Default'};
88 pls = getDefaultPlist;
89 end
90 % Build info object
91 ii = minfo(mfilename, 'matrix', 'ltpda', utils.const.categories.aop, '$Id: fft.m,v 1.6 2011/04/08 08:56:31 hewitson Exp $', sets, pls);
92 ii.setArgsmin(2);
93 ii.setModifier(false);
94 end
95
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 %
98 % FUNCTION: getDefaultPlist
99 %
100 % DESCRIPTION: Get Default Plist
101 %
102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
103
104 function plout = getDefaultPlist()
105 persistent pl;
106 if exist('pl', 'var')==0 || isempty(pl)
107 pl = buildplist();
108 end
109 plout = pl;
110 end
111
112 function pl = buildplist()
113 pl = plist({'type', 'The fft type. Plain (complete non-symmetric), One-sided (from zero to Nyquist) or two-sided (complete symmetric).'},...
114 {2, {'plain', 'one', 'two'}, paramValue.SINGLE});
115 end