Mercurial > hg > ltpda
comparison m-toolbox/m/built_in_models/ao/ao_model_squarewave.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 % AO_MODEL_SQUAREWAVE constructs a square-wave time-series | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: AO_MODEL_SQUAREWAVE constructs a square-wave time-series | |
5 % | |
6 % CALL: a = ao(plist('built-in', 'squarewave'), pl); | |
7 % | |
8 % INPUTS: | |
9 % pl - a parameter list of additional parameters (see below) | |
10 % | |
11 % OUTPUTS: | |
12 % mdl - an AO object representing the time-series of the signal | |
13 % | |
14 % | |
15 % INFO: | |
16 % <a href="matlab:utils.models.displayModelOverview('ao_model_squarewave')">Model Information</a> | |
17 % | |
18 % | |
19 % REFERENCES: | |
20 % | |
21 % | |
22 % VERSION: $Id: ao_model_squarewave.m,v 1.4 2011/04/29 08:04:07 hewitson Exp $ | |
23 % | |
24 % HISTORY: | |
25 % | |
26 % | |
27 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
28 | |
29 function varargout = ao_model_squarewave(varargin) | |
30 | |
31 varargout = utils.models.mainFnc(varargin(:), ... | |
32 mfilename, ... | |
33 @getModelDescription, ... | |
34 @getModelDocumentation, ... | |
35 @getVersion, ... | |
36 @versionTable); | |
37 | |
38 end | |
39 | |
40 %-------------------------------------------------------------------------- | |
41 % AUTHORS EDIT THIS PART | |
42 %-------------------------------------------------------------------------- | |
43 | |
44 function desc = getModelDescription | |
45 desc = 'Constructs a square-wave time-series'; | |
46 end | |
47 | |
48 function doc = getModelDocumentation | |
49 doc = sprintf([... | |
50 'No documentation at the moment' ... | |
51 ]); | |
52 end | |
53 | |
54 % default version is always the first one | |
55 function vt = versionTable() | |
56 | |
57 vt = {... | |
58 'Initial version', @version01, ... | |
59 }; | |
60 | |
61 end | |
62 | |
63 | |
64 % This version is the initial one | |
65 % | |
66 function varargout = version01(varargin) | |
67 | |
68 if nargin == 1 && ischar(varargin{1}) | |
69 switch varargin{1} | |
70 case 'plist' | |
71 | |
72 % The plist for this version of this model | |
73 pl = plist(); | |
74 | |
75 % parameters 'Fs', 'Nsecs', 'Xunits' | |
76 pl.append(plist.TSDATA_PLIST); | |
77 | |
78 % parameter 'F' | |
79 p = param({'f', 'Frequency of the signal.'}, ... | |
80 {1, {1}, paramValue.OPTIONAL}); | |
81 pl.append(p); | |
82 | |
83 % parameter 'Yunits' | |
84 p = param({'yunits','Unit on Y axis.'}, paramValue.STRING_VALUE('')); | |
85 pl.append(p); | |
86 | |
87 % set output | |
88 varargout{1} = pl; | |
89 | |
90 case 'description' | |
91 varargout{1} = 'This version is the initial one'; | |
92 case 'info' | |
93 varargout{1} = []; | |
94 otherwise | |
95 error('unknown inputs'); | |
96 end | |
97 return; | |
98 end | |
99 | |
100 % build model | |
101 pl = varargin{1}; | |
102 fs = find(pl, 'fs'); | |
103 nsecs = find(pl, 'nsecs'); | |
104 f = find(pl, 'f'); | |
105 xunits = find(pl, 'xunits'); | |
106 yunits = find(pl, 'yunits'); | |
107 | |
108 % Build the AO and set its name | |
109 spl = plist('waveform', 'squarewave', ... | |
110 'fs', fs, ... | |
111 'nsecs', nsecs, ... | |
112 'f', f, ... | |
113 'yunits', yunits, ... | |
114 'xunits', xunits, ... | |
115 'name', 'Square wave' ... | |
116 ); | |
117 | |
118 a = ao(spl); | |
119 a.setProcinfo(spl); | |
120 | |
121 varargout{1} = a; | |
122 | |
123 end | |
124 | |
125 | |
126 %-------------------------------------------------------------------------- | |
127 % AUTHORS SHOULD NOT NEED TO EDIT BELOW HERE | |
128 %-------------------------------------------------------------------------- | |
129 | |
130 | |
131 %-------------------------------------------------------------------------- | |
132 % Get Version | |
133 %-------------------------------------------------------------------------- | |
134 function v = getVersion | |
135 | |
136 v = '$Id: ao_model_squarewave.m,v 1.4 2011/04/29 08:04:07 hewitson Exp $'; | |
137 | |
138 end | |
139 |