comparison m-toolbox/classes/@ao/phase.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 % PHASE is the phase operator for analysis objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: PHASE is the phase operator for analysis objects.
5 % Uses utils.math.phase() to compute the phase angle.
6 %
7 % CALL: ao_out = phase(ao_in);
8 % ao_out = phase(ao_in, pl);
9 %
10 % PARAMETERS: see help for data2D/applymethod for additional parameters
11 %
12 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'phase')">Parameters Description</a>
13 %
14 % VERSION: $Id: phase.m,v 1.34 2011/04/19 18:48:11 ingo Exp $
15 %
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
18 function varargout = phase(varargin)
19
20 % Check if the method was called by another method
21 callerIsMethod = utils.helper.callerIsMethod;
22
23 % Settings
24 operatorName = 'utils.math.phase';
25 dxFcn = @(x,dx)atan2(abs(dx),abs(x))*180/pi;
26
27 if callerIsMethod
28 in_names = {};
29 else
30 % Collect input variable names
31 in_names = cell(size(varargin));
32 for ii = 1:nargin,in_names{ii} = inputname(ii);end
33 end
34
35 copyObjects = nargout>0;
36 [bs, pl] = ao.applymethod(copyObjects, callerIsMethod, in_names, operatorName, dxFcn, @getInfo, @getDefaultPlist, varargin{:});
37
38 if isa(bs, 'ao')
39 % Set units
40 setUnitsForAxis(bs, pl, 'deg');
41 end
42
43 % set outputs
44 varargout = utils.helper.setoutputs(nargout, bs);
45
46 end
47
48 %--------------------------------------------------------------------------
49 % Get Info Object
50 %--------------------------------------------------------------------------
51 function ii = getInfo(varargin)
52 ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin);
53 end
54
55 %--------------------------------------------------------------------------
56 % Get Default Plist
57 %--------------------------------------------------------------------------
58
59 function plout = getDefaultPlist(set)
60 persistent pl;
61 persistent lastset;
62 if ~exist('pl', 'var') || isempty(pl) || ~strcmp(lastset, set)
63 pl = buildplist(set);
64 lastset = set;
65 end
66 plout = pl;
67 end
68
69 function plout = buildplist(varargin)
70 plout = plist.getDefaultAxisPlist(varargin{:});
71 end