Home > m > timetools > statespacefunctions > utp_ltpda_ss_modify.m

utp_ltpda_ss_modify

PURPOSE ^

tests ltpda_ss_modify

SYNOPSIS ^

function result = utp_ltpda_ss_modify(varargin)

DESCRIPTION ^

 tests ltpda_ss_modify
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: tests ltpda_ss_modify, syntaxic test

 CALL: utp_ltpda_ss_modify

 INPUTS: 1/0

 OUTPUTS: 0 or zero

 ***** THERE ARE NO DEFAULT PARAMETERS *****

 VERSION: $Id: utp_ltpda_ss_modify.m,v 1.2 2008/02/20 09:20:07 adrien Exp $

 HISTORY: 19-02-2008 A Grynagier
 13-02-2008 A Grynagier
 Creation 02-02-2008 A Grynagier

 TO DO : numerical test

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function result = utp_ltpda_ss_modify(varargin)
0002 % tests ltpda_ss_modify
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 % DESCRIPTION: tests ltpda_ss_modify, syntaxic test
0006 %
0007 % CALL: utp_ltpda_ss_modify
0008 %
0009 % INPUTS: 1/0
0010 %
0011 % OUTPUTS: 0 or zero
0012 %
0013 % ***** THERE ARE NO DEFAULT PARAMETERS *****
0014 %
0015 % VERSION: $Id: utp_ltpda_ss_modify.m,v 1.2 2008/02/20 09:20:07 adrien Exp $
0016 %
0017 % HISTORY: 19-02-2008 A Grynagier
0018 % 13-02-2008 A Grynagier
0019 % Creation 02-02-2008 A Grynagier
0020 %
0021 % TO DO : numerical test
0022 %
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 ALGONAME = mfilename;
0025 VERSION = '$Id: utp_ltpda_ss_modify.m,v 1.2 2008/02/20 09:20:07 adrien Exp $';
0026 result = 1;
0027 display(['starting ' mfilename]);
0028 
0029 for i=1:100
0030 %% makes random data
0031     nSysTot = floor(rand()*4)+1;
0032     pSys = floor(rand()*nSysTot)+1;
0033     nUTot = floor(rand()*nSysTot)+1;
0034     OutputSizes = floor(rand(nSysTot,1)*5);
0035     InputSizes = floor(rand(nUTot,1)*5);
0036     syst = utp_ltpda_ss_random_generate(nSysTot, pSys, nUTot, OutputSizes, InputSizes);
0037 
0038 %% retrieving data
0039 %     Names = find(syst,'NAME');
0040 %     Timestep = find(syst,'TIMESTEP');
0041 %     Xini = find(syst,'XINI');
0042     AMat = find(syst,'AMAT');
0043 %     BMats = find(syst,'BMATS');
0044 %     CMat = find(syst,'CMAT');
0045 %     DMats = find(syst,'DMATS');
0046     % parametric data
0047     ParamNames = find(syst,'PARAMNAMES');
0048     ParamValue = find(syst,'PARAMVALUES');
0049 %     ParamSigma = find(syst,'PARAMSIGMAS');
0050     NbParam = length(ParamNames);
0051     % input data
0052 %     InputNames = find(syst,'INPUTNAMES');
0053 %     InputSizes = find(syst,'INPUTSIZES');
0054 %     IsUsed = find(syst,'INPUTISUSED');
0055 %     NbInputs = length(InputNames);
0056     % output data
0057 %     XIsOutput = find(syst,'XISOUTPUT');
0058 %     YIsOutput = find(syst,'YISOUTPUT');
0059     
0060 %% modifying system
0061 %     A0 = AMat{1};
0062 %     p=1;
0063 %     for j = 1:NbParam
0064 %         p = p * ParamValue(j);
0065 %         if length(A0)>j
0066 %             A0(j)=A0(j)*p;
0067 %         end
0068 %     end
0069 %     syst = pset(syst, 'AMAT', {A0});
0070             
0071 
0072 
0073 %% setting modification option
0074     command = floor(2*rand(11,1));
0075     if NbParam>1&&command(1)
0076         NOT_USED_PARAM_NAMES = {ParamNames{1}, ParamNames{2}};
0077         NOT_USED_PARAM_ORDER = [1 0];
0078     else
0079         NOT_USED_PARAM_NAMES = {};
0080         NOT_USED_PARAM_ORDER = [];
0081     end
0082 
0083     if NbParam>5
0084         SET_PARAM_NAMES = {ParamNames{3}, ParamNames{4}, ParamNames{5}, ParamNames{6}};
0085         if command(3)
0086             SET_PARAM_VALUES_ORDER = [1 1 0 0];
0087         elseif command(4)
0088             SET_PARAM_VALUES_ORDER = 'ALL';
0089         else
0090             SET_PARAM_VALUES_ORDER = 'NO';
0091         end
0092         if command(5)
0093             SET_PARAM_SIGMAS_ORDER = [1 0 1 0];
0094         elseif command(6)
0095             SET_PARAM_SIGMAS_ORDER = 'ALL';
0096         else
0097             SET_PARAM_SIGMAS_ORDER = 'NO';
0098         end
0099     else
0100         SET_PARAM_NAMES = {};
0101         if command(3)
0102             SET_PARAM_VALUES_ORDER = [];
0103         elseif command(4)
0104             SET_PARAM_VALUES_ORDER = 'ALL';
0105         else
0106             SET_PARAM_VALUES_ORDER = 'NO';
0107         end
0108         if command(5)
0109             SET_PARAM_SIGMAS_ORDER = [];
0110         elseif command(6)
0111             SET_PARAM_SIGMAS_ORDER = 'ALL';
0112         else
0113             SET_PARAM_SIGMAS_ORDER = 'NO';
0114         end
0115     end
0116     SET_PARAM_VALUES = randn(1,length(SET_PARAM_NAMES));
0117     SET_PARAM_SIGMAS = 0.1*rand(1,length(SET_PARAM_NAMES));
0118 
0119     if NbParam>10
0120         JAC_PARAM_NAMES = {ParamNames{4}, ParamNames{5}, ParamNames{7}, ParamNames{8}, ParamNames{9}, ParamNames{10}};
0121         if command(5)
0122             JAC_PARAM_ORDER = [1 0 1 1 0 0];
0123         elseif command(6)
0124             JAC_PARAM_ORDER = 'ALL';
0125         else
0126             JAC_PARAM_ORDER = 'NO';
0127         end
0128     else
0129         JAC_PARAM_NAMES = {};
0130         if command(5)
0131             JAC_PARAM_ORDER = [];
0132         elseif command(6)
0133             JAC_PARAM_ORDER = 'ALL';
0134         else
0135             JAC_PARAM_ORDER = 'NO';
0136         end
0137     end
0138     if NbParam>10
0139         HESS_PARAM_NAMES = {ParamNames{4}, ParamNames{5}, ParamNames{7}, ParamNames{8}, ParamNames{9}, ParamNames{10}};
0140         if command(7)
0141             HESS_PARAM_ORDER = [1 0 1 0 1 0];
0142         elseif command(8)
0143             HESS_PARAM_ORDER = 'ALL';
0144         else
0145             HESS_PARAM_ORDER = 'NO';
0146         end
0147     else
0148         HESS_PARAM_NAMES = {};
0149         if command(9)
0150             HESS_PARAM_ORDER = [];
0151         elseif command(10)
0152             HESS_PARAM_ORDER = 'ALL';
0153         else
0154             HESS_PARAM_ORDER = 'NO';
0155         end
0156     end
0157     SYMBOLIC_OUTPUT_ALLOWED = command(11);
0158     options = plist( 'NOT_USED_PARAM_NAMES' , NOT_USED_PARAM_NAMES , 'NOT_USED_PARAM_ORDER' , NOT_USED_PARAM_ORDER , ...
0159         'SET_PARAM_NAMES' , SET_PARAM_NAMES , 'SET_PARAM_VALUES' , SET_PARAM_VALUES , 'SET_PARAM_SIGMAS' , SET_PARAM_SIGMAS , ...
0160         'SET_PARAM_VALUES_ORDER', SET_PARAM_VALUES_ORDER , 'SET_PARAM_SIGMAS_ORDER' , SET_PARAM_SIGMAS_ORDER , ...
0161         'JAC_PARAM_NAMES' , JAC_PARAM_NAMES ,  'JAC_PARAM_ORDER', JAC_PARAM_ORDER , ...
0162         'HESS_PARAM_NAMES' , HESS_PARAM_NAMES ,  'HESS_PARAM_ORDER', HESS_PARAM_ORDER , ...
0163         'SYMBOLIC_OUTPUT_ALLOWED', SYMBOLIC_OUTPUT_ALLOWED);
0164 
0165 %% launching function
0166     try
0167         subsys = ltpda_ss_modify(syst,options);
0168         display('OK')
0169     catch
0170         display('FAIL')
0171         result = 0;
0172     end
0173 
0174 
0175 end
0176 
0177 end
0178

Generated on Tue 26-Feb-2008 10:52:52 by m2html © 2003