


ltpda_ss_make is the generic function to decalre or load a subsystem.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: ltpda_ss_make is the generic function to decalre or load a
subsystem.
CALL: subsys = makeSubsystem(varargin)
INPUTS: 3 possibilites
varargin - plist describibg a subsystem
varargin - string, name of a workspace to be loaded where all the
parameters content for the plist are contained and named using the
corresponding parameter name.
varargin - a PZ model to be converted into a state space model (eg.to run
a simulation in the time domain later.)
OUTPUTS: subsys - subsystem dscribed by a plist
subsystem plist format (More updated infos might be available in the
ltpda_ss_check function):
plist('TYPE', TYPE ,'NAME', NAME ,'TIMESTEP', TIMESTEP ,...
'PARAMNAMES', PARAMNAMES ,'PARAMVALUES', PARAMVALUES ,'PARAMSIGMAS', PARAMSIGMAS ,...
'NBINPUTS', NBINPUTS ,'INPUTNAMES', INPUTNAMES ,'INPUTSIZES', INPUTSIZES ,'INPUTISUSED', INPUTISUSED ,...
'AMAT', AMAT ,'BMATS', BMATS ,'CMAT', CMAT ,'DMATS', DMATS );% PARAMETERS:
'TYPE' should be 'SUBSYSTEM'
'NAME' is a string
'TIMESTEP' is a real positive integer, set to zero in continuous case
'PARAMNAMES' cell array of strings describing parameter variables
'PARAMVALUES' array of doubles (means expected of parameters)
'PARAMSIGMAS' array of doubles (variance expected of parameters)
'NBINPUTS' integer number of inputs
'INPUTNAMES' cell array of strings (name of the inputs)
'INPUTSIZES'array of integers (nb of dimensions of the inputs),
'INPUTISUSED' double array (binary to indicate which inputs are used)
'AMAT' cell array (contains A matrix)
'BMATS' cell array (contains B matrices)
'CMAT' cell array (contains C matrix)
'DMATS' cell array (contains D matrices)
***** THERE ARE NO DEFAULT PARAMETERS *****
VERSION: $Id: ltpda_ss_make.m,v 1.3 2008/02/25 12:43:44 adrien Exp $
HISTORY: 18-02-2008 A Grynagier
22-01-2008 A Grynagier
Creation 02-01-2008 A Grynagier
TO DO : finnish and check the iir and plist parts - see also test function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0001 function varargout = ltpda_ss_make(varargin) 0002 % ltpda_ss_make is the generic function to decalre or load a subsystem. 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % DESCRIPTION: ltpda_ss_make is the generic function to decalre or load a 0006 % subsystem. 0007 % 0008 % CALL: subsys = makeSubsystem(varargin) 0009 % 0010 % INPUTS: 3 possibilites 0011 % varargin - plist describibg a subsystem 0012 % varargin - string, name of a workspace to be loaded where all the 0013 % parameters content for the plist are contained and named using the 0014 % corresponding parameter name. 0015 % varargin - a PZ model to be converted into a state space model (eg.to run 0016 % a simulation in the time domain later.) 0017 % 0018 % OUTPUTS: subsys - subsystem dscribed by a plist 0019 % 0020 % subsystem plist format (More updated infos might be available in the 0021 % ltpda_ss_check function): 0022 % plist('TYPE', TYPE ,'NAME', NAME ,'TIMESTEP', TIMESTEP ,... 0023 % 'PARAMNAMES', PARAMNAMES ,'PARAMVALUES', PARAMVALUES ,'PARAMSIGMAS', PARAMSIGMAS ,... 0024 % 'NBINPUTS', NBINPUTS ,'INPUTNAMES', INPUTNAMES ,'INPUTSIZES', INPUTSIZES ,'INPUTISUSED', INPUTISUSED ,... 0025 % 'AMAT', AMAT ,'BMATS', BMATS ,'CMAT', CMAT ,'DMATS', DMATS );% PARAMETERS: 0026 % 'TYPE' should be 'SUBSYSTEM' 0027 % 'NAME' is a string 0028 % 'TIMESTEP' is a real positive integer, set to zero in continuous case 0029 % 'PARAMNAMES' cell array of strings describing parameter variables 0030 % 'PARAMVALUES' array of doubles (means expected of parameters) 0031 % 'PARAMSIGMAS' array of doubles (variance expected of parameters) 0032 % 'NBINPUTS' integer number of inputs 0033 % 'INPUTNAMES' cell array of strings (name of the inputs) 0034 % 'INPUTSIZES'array of integers (nb of dimensions of the inputs), 0035 % 'INPUTISUSED' double array (binary to indicate which inputs are used) 0036 % 'AMAT' cell array (contains A matrix) 0037 % 'BMATS' cell array (contains B matrices) 0038 % 'CMAT' cell array (contains C matrix) 0039 % 'DMATS' cell array (contains D matrices) 0040 % ***** THERE ARE NO DEFAULT PARAMETERS ***** 0041 % 0042 % VERSION: $Id: ltpda_ss_make.m,v 1.3 2008/02/25 12:43:44 adrien Exp $ 0043 % 0044 % HISTORY: 18-02-2008 A Grynagier 0045 % 22-01-2008 A Grynagier 0046 % Creation 02-01-2008 A Grynagier 0047 % 0048 % TO DO : finnish and check the iir and plist parts - see also test function 0049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0050 0051 %% standard calls for LTPDA function data 0052 0053 ALGONAME = mfilename; 0054 VERSION = '$Id: ltpda_ss_make.m,v 1.3 2008/02/25 12:43:44 adrien Exp $'; 0055 CATEGORY = 'STATESPACE'; 0056 display(['starting ' ALGONAME]); 0057 0058 if isequal( varargin{1}, 'Version') 0059 varargout = VERSION; 0060 return; 0061 elseif isequal(varargin{1}, 'Params') 0062 varargout = plist(); 0063 return; 0064 elseif isequal(varargin{1}, 'Category') 0065 varargout = CATEGORY; 0066 return; 0067 end 0068 0069 0070 % % Collect input ao's, plist's and ao variable names 0071 % in_names = {}; 0072 % for ii = 1:nargin 0073 % in_names{end+1} = inputname(ii); 0074 % end 0075 % 0076 % [as, ps, invars] = collect_inputs(varargin, in_names); 0077 % 0078 % ps = combine(ps, getDefaultPlist); 0079 % 0080 % subsys = plist(ps.params.key, eval(ps.params.val)); 0081 0082 0083 0084 0085 %% proceeding data 0086 if ischar(varargin{1}) 0087 pathbelow = 'LTPDA_SS_GEN_1\'; 0088 cmd1 = ['struct = load( ''',pathbelow, varargin{1} , ''' ); ']; 0089 0090 cmd2 = ['subsys = struct.', varargin{1} , '; ']; 0091 eval(cmd1); 0092 eval(cmd2); 0093 ltpda_ss_check(subsys); %#ok<NODEF> 0094 elseif isequal(class(varargin{1}), 'plist object') 0095 subsys = varargin{1}; 0096 ltpda_ss_check(subsys); 0097 elseif isequal(class(varargin{1}), 'pzmodel') 0098 pzm = varargin{1}; 0099 display('not fully implemented yet'); 0100 subsys = ltpda_ss_pz2ss(pzm); 0101 elseif isequal(class(varargin{1}), 'miir') 0102 iir = varargin{1}; 0103 subsys = ltpda_ss_iir2ss(iir); 0104 else 0105 error('wrong type of input: not a string nor a plist object'); 0106 end 0107 ltpda_ss_check(subsys); 0108 varargout = subsys; 0109 end 0110 0111 0112 0113