Mercurial > hg > ltpda
view m-toolbox/m/built_in_models/ao/ao_model_step.m @ 22:b11e88004fca database-connection-manager
Update collection.fromRepository
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% AO_MODEL_STEP constructs a step-function time-series %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: AO_MODEL_STEP constructs a step-function time-series % % CALL: a = ao(plist('built-in', 'step'), pl); % % OUTPUTS: % mdl - an AO object representing the time-series of the signal % % % INFO: % <a href="matlab:utils.models.displayModelOverview('ao_model_step')">Model Information</a> % % % REFERENCES: % % % VERSION: $Id: ao_model_step.m,v 1.4 2011/04/29 08:04:07 hewitson Exp $ % % HISTORY: % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function varargout = ao_model_step(varargin) varargout = utils.models.mainFnc(varargin(:), ... mfilename, ... @getModelDescription, ... @getModelDocumentation, ... @getVersion, ... @versionTable); end %-------------------------------------------------------------------------- % AUTHORS EDIT THIS PART %-------------------------------------------------------------------------- function desc = getModelDescription desc = 'Constructs a step-function time-series'; end function doc = getModelDocumentation doc = sprintf([... 'No documentation at the moment' ... ]); end % default version is always the first one function vt = versionTable() vt = {... 'Initial version', @version01, ... }; end % This version is the initial one % function varargout = version01(varargin) if nargin == 1 && ischar(varargin{1}) switch varargin{1} case 'plist' % The plist for this version of this model pl = plist(); % parameters 'Fs', 'Nsecs', 'Xunits' pl.append(plist.TSDATA_PLIST); % parameter 'A' p = param({'A','Amplitude of the signal.'}, {1, {1}, paramValue.OPTIONAL}); pl.append(p); % parameter 'Toff' p = param({'Toff', ['Offset of the step, as a number of seconds']}, {1, {0}, paramValue.OPTIONAL}); pl.append(p); % parameter 'Yunits' p = param({'yunits','Unit on Y axis.'}, paramValue.STRING_VALUE('')); pl.append(p); % set output varargout{1} = pl; case 'description' varargout{1} = 'This version is the initial one'; case 'info' varargout{1} = []; otherwise error('unknown inputs'); end return; end % build model pl = varargin{1}; fs = find(pl, 'fs'); nsecs = find(pl, 'nsecs'); A = find(pl, 'A'); toff = find(pl, 'toff'); xunits = find(pl, 'xunits'); yunits = find(pl, 'yunits'); % build data vectors t = 0 : 1/fs : nsecs - 1/fs; y = A*(t >= toff); % Build a time-series AO and set its name, X-units, Y-units spl = plist(... 'xvals', t, ... 'yvals', y, ... 'type', 'tsdata', ... 'fs', fs, ... 'xunits', 's', ... 'yunits', yunits, ... 'name', 'Step' ... ); a = ao(spl); a.setProcinfo(spl); varargout{1} = a; end %-------------------------------------------------------------------------- % AUTHORS SHOULD NOT NEED TO EDIT BELOW HERE %-------------------------------------------------------------------------- %-------------------------------------------------------------------------- % Get Version %-------------------------------------------------------------------------- function v = getVersion v = '$Id: ao_model_step.m,v 1.4 2011/04/29 08:04:07 hewitson Exp $'; end