comparison m-toolbox/m/built_in_models/smodel/smodel_model_sinewave.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 % A built-in model of class ao called sinewave
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: A built-in model of class ao called sinewave
5 %
6 % CALL:
7 % mdl = smodel(plist('built-in', 'sinewave'));
8 %
9 % INPUTS:
10 %
11 %
12 % OUTPUTS:
13 % mdl - an object of class smodel
14 %
15 %
16 % INFO:
17 % <a href="matlab:utils.models.displayModelOverview('smodel_model_sinewave')">Model Information</a>
18 %
19 %
20 % REFERENCES:
21 %
22 %
23 % VERSION: $Id: smodel_model_sinewave.m,v 1.3 2011/04/29 12:25:03 luigi Exp $
24 %
25 % HISTORY:
26 %
27 %
28 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29
30 % YOU SHOULD NOT NEED TO EDIT THIS MAIN FUNCTION
31 function varargout = smodel_model_sinewave(varargin)
32
33 varargout = utils.models.mainFnc(varargin(:), ...
34 mfilename, ...
35 @getModelDescription, ...
36 @getModelDocumentation, ...
37 @getVersion, ...
38 @versionTable);
39
40 end
41
42
43 %--------------------------------------------------------------------------
44 % AUTHORS EDIT THIS PART
45 %--------------------------------------------------------------------------
46
47 function desc = getModelDescription
48 desc = 'constructs a sine-wave with amplitude A, frequency f, phase phi in degrees.';
49 end
50
51 function doc = getModelDocumentation
52 doc = sprintf([...
53 ''...
54 ]);
55 end
56
57 % default version is always the first one
58 function vt = versionTable()
59
60 vt = {...
61 'Version 1', @version1, ...
62 };
63
64 end
65
66 % This version is ...
67 %
68 function varargout = version1(varargin)
69
70 if nargin == 1 && ischar(varargin{1})
71 switch varargin{1}
72 case 'plist'
73
74 % The plist for this version of this model
75 pl = plist();
76
77
78
79 % set output
80 varargout{1} = pl;
81
82 case 'description'
83 varargout{1} = 'This version is version 1.';
84 case 'info'
85 % Add info calls for any other models that you use to build this
86 % model. For example:
87 % varargout{1} = [ ...
88 % ao_model_SubModel1('info', 'Some Version') ...
89 % ao_model_SubModel2('info', 'Another Version') ...
90 % ];
91 %
92 varargout{1} = [];
93 otherwise
94 error('unknown inputs');
95 end
96 return;
97 end
98
99 % build model
100 pl = varargin{1};
101
102 a = smodel('A.*sin(2.*pi.*f.*t + phi*pi/180)');
103 a.setXvar('t');
104 a.setParams({'A','f','phi'}, {[],[],[]});
105 a.setName('Sine wave');
106 a.setDescription('Sine wave with amplitude A, frequency f, phase phi in degrees');
107
108 varargout{1} = a;
109
110 end
111
112
113 %--------------------------------------------------------------------------
114 % AUTHORS SHOULD NOT NEED TO EDIT BELOW HERE
115 %--------------------------------------------------------------------------
116
117
118 %--------------------------------------------------------------------------
119 % Get Version
120 %--------------------------------------------------------------------------
121 function v = getVersion
122
123 v = '$Id: smodel_model_sinewave.m,v 1.3 2011/04/29 12:25:03 luigi Exp $';
124
125 end