0001 function varargout = utp_ltpda_ss_select(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 ALGONAME = mfilename;
0023 VERSION = '$Id: utp_ltpda_ss_select.m,v 1.1 2008/03/11 16:52:56 adrien Exp $';
0024 CATEGORY = 'STATESPACE';
0025 display(['starting ' ALGONAME]);
0026
0027 if not(isempty(varargin))
0028 if isequal( varargin{1}, 'Version')
0029 varargout = VERSION;
0030 return;
0031 elseif isequal(varargin{1}, 'Params')
0032 varargout = plist( 'Inputs', cell(1,0), 'Outputs', cell(1,0) );
0033 return;
0034 elseif isequal(varargin{1}, 'Category')
0035 varargout = CATEGORY;
0036 return;
0037 end
0038 end
0039
0040 output = 1;
0041 for count=1:100
0042 try
0043
0044 nss = floor(5*rand(1));
0045 nout = floor(4*rand(1));
0046 nin = floor(10*rand(1));
0047 inSize = floor(5*rand(1,nin));
0048
0049
0050 AMAT = {rand(nss,nss)};
0051 BMATS = cell(1,nin);
0052 CMAT = {rand(nout, nss)};
0053 DMATS = cell(1,nin);
0054 for i=1:nin
0055 DMATS{i} = rand(nout,inSize(i));
0056 BMATS{i} = rand(nss,inSize(i));
0057 end
0058 inputisused = floor(2*rand(1,nin));
0059
0060 invarnames = cell(1,nin);
0061 inputnames = cell(1,nin);
0062 for i=1:nin
0063 invaranmes_loc = cell(1,inSize(i));
0064 for j = 1:inSize(i)
0065 invaranmes_loc{j} = ['INPUT_', num2str(i),'_',num2str(j)];
0066 end
0067 inputnames{i} = ['INPUT_', num2str(i)];
0068 invarnames{i} = invaranmes_loc;
0069 end
0070 outputvarnames = cell(1, nout);
0071 for i=1:nout
0072 outputvarnames{i} = ['OUTPUT_', num2str(i)];
0073 end
0074 ssvarnames = cell(1, nss);
0075 for i=1:nss
0076 ssvarnames{i} = ['X_', num2str(i)];
0077 end
0078
0079 Outputs = [];
0080 j = 0;
0081 for k=1:nout
0082 if rand()>0.5
0083 j = j+1;
0084 Outputs(j) = k;
0085 end
0086 end
0087 Inputs = cell(1,nin);
0088 for i=1:nin
0089 j = 0;
0090 inselect = [];
0091 for k=1:inSize(i)
0092 if rand()>0.5
0093 j = j+1;
0094 inselect(j) = k;
0095 end
0096 end
0097 Inputs{i} = inselect;
0098 end
0099
0100 syst = plist('TYPE', 'SSSYSTEM' ,'NAME', 'TEST_select' ,'TIMESTEP', 0 ,...
0101 'PARAMNAMES', {} ,'PARAMVALUES', [] ,'PARAMSIGMAS', [] ,...
0102 'NBINPUTS', nin ,'INPUTNAMES', inputnames ,'INPUTSIZES', inSize ,'INPUTISUSED', inputisused ,...
0103 'INPUTVARNAMES', invarnames , 'OUTPUTVARNAMES', outputvarnames, 'SSVARNAMES', ssvarnames,...
0104 'AMAT', AMAT ,'BMATS', BMATS ,'CMAT', CMAT ,'DMATS', DMATS );
0105 ltpda_ss_check(syst);
0106 modifs = plist('Inputs', Inputs, 'outputs', Outputs);
0107 syst2 = ltpda_ss_select(syst, modifs);
0108 catch
0109 output = 0;
0110 end
0111 end
0112 varargout = {output};
0113 end