Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/sin.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 % SIN overloads the sin method for analysis objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: SIN overloads the sin operator for analysis objects. | |
5 % | |
6 % CALL: ao_out = sin(ao_in); | |
7 % ao_out = sin(ao_in, pl); | |
8 % ao_out = sin(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', 'sin')">Parameters Description</a> | |
15 % | |
16 % VERSION: $Id: sin.m,v 1.44 2011/04/19 18:48:11 ingo Exp $ | |
17 % | |
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
19 | |
20 function varargout = sin(varargin) | |
21 | |
22 % Check if the method was called by another method | |
23 callerIsMethod = utils.helper.callerIsMethod; | |
24 | |
25 % Settings | |
26 operatorName = 'sin'; | |
27 dxFcn = @(x,dx)abs(cos(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 |