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