Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/acos.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 % ACOS overloads the acos method for analysis objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: ACOS overloads the acos operator for analysis objects. | |
5 % Inverse cosine result in radians. | |
6 % ACOS(ao) is the arccosine of the elements of ao.data. | |
7 % | |
8 % CALL: ao_out = acos(ao_in); | |
9 % ao_out = acos(ao_in, pl); | |
10 % ao_out = acos(ao1, pl1, ao_vector, ao_matrix, pl2); | |
11 % | |
12 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'acos')">Parameters Description</a> | |
13 % | |
14 % VERSION: $Id: acos.m,v 1.38 2011/04/19 18:48:11 ingo Exp $ | |
15 % | |
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
17 | |
18 function varargout = acos(varargin) | |
19 | |
20 % Check if the method was called by another method | |
21 callerIsMethod = utils.helper.callerIsMethod; | |
22 | |
23 % Settings | |
24 operatorName = 'acos'; | |
25 dxFcn = @(x,dx)abs(-1./(1 - x.^2).^(1/2)).*dx; | |
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 % Set units | |
39 if isa(bs, 'ao') | |
40 setUnitsForAxis(bs, pl, 'rad'); | |
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 | |
53 ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin); | |
54 end | |
55 | |
56 %-------------------------------------------------------------------------- | |
57 % Get Default Plist | |
58 %-------------------------------------------------------------------------- | |
59 | |
60 function plout = getDefaultPlist(set) | |
61 persistent pl; | |
62 persistent lastset; | |
63 if ~exist('pl', 'var') || isempty(pl) || ~strcmp(lastset, set) | |
64 pl = buildplist(set); | |
65 lastset = set; | |
66 end | |
67 plout = pl; | |
68 end | |
69 | |
70 function plout = buildplist(varargin) | |
71 plout = plist.getDefaultAxisPlist(varargin{:}); | |
72 end | |
73 |