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