Home > m > timetools > statespacefunctions > utp_ltpda_ss_modify.m

utp_ltpda_ss_modify

PURPOSE ^

tests ltpda_ss_modify

SYNOPSIS ^

function varargout = 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.html,v 1.4 2008/03/31 10:27:35 hewitson 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 varargout = 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.html,v 1.4 2008/03/31 10:27:35 hewitson 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.html,v 1.4 2008/03/31 10:27:35 hewitson Exp $';
0026 CATEGORY = 'STATESPACE';
0027 display(['starting ' ALGONAME]);
0028 
0029 if not(isempty(varargin))
0030     if isequal( varargin{1}, 'Version')
0031         varargout = VERSION;
0032         return;
0033     elseif isequal(varargin{1}, 'Params')
0034         varargout = plist();
0035         return;
0036     elseif isequal(varargin{1}, 'Category')
0037         varargout = CATEGORY;
0038         return;
0039     end
0040 end
0041 result = 1;
0042 
0043 for i=1:100
0044 %% makes random data
0045     nSysTot = floor(rand()*4)+1;
0046     pSys = floor(rand()*nSysTot)+1;
0047     nUTot = floor(rand()*nSysTot)+1;
0048     OutputSizes = floor(rand(nSysTot,1)*5);
0049     InputSizes = floor(rand(nUTot,1)*5);
0050     syst = utp_ltpda_ss_random_generate(nSysTot, pSys, nUTot, OutputSizes, InputSizes);
0051 
0052 %% retrieving data
0053 %     Names = find(syst,'NAME');
0054 %     Timestep = find(syst,'TIMESTEP');
0055 %     Xini = find(syst,'XINI');
0056 %     AMat = find(syst,'AMAT');
0057 %     BMats = find(syst,'BMATS');
0058 %     CMat = find(syst,'CMAT');
0059 %     DMats = find(syst,'DMATS');
0060     % parametric data
0061     ParamNames = find(syst,'PARAMNAMES');
0062 %     ParamValue = find(syst,'PARAMVALUES');
0063 %     ParamSigma = find(syst,'PARAMSIGMAS');
0064     NbParam = length(ParamNames);
0065     % input data
0066 %     InputNames = find(syst,'INPUTNAMES');
0067 %     InputSizes = find(syst,'INPUTSIZES');
0068 %     IsUsed = find(syst,'INPUTISUSED');
0069 %     NbInputs = length(InputNames);
0070     % output data
0071 %     XIsOutput = find(syst,'XISOUTPUT');
0072 %     YIsOutput = find(syst,'YISOUTPUT');
0073     
0074 %% modifying system
0075 %     A0 = AMat{1};
0076 %     p=1;
0077 %     for j = 1:NbParam
0078 %         p = p * ParamValue(j);
0079 %         if length(A0)>j
0080 %             A0(j)=A0(j)*p;
0081 %         end
0082 %     end
0083 %     syst = pset(syst, 'AMAT', {A0});
0084             
0085 
0086 
0087 %% setting modification option
0088     command = floor(2*rand(11,1));
0089     if NbParam>1&&command(1)
0090         NOT_USED_PARAM_NAMES = {ParamNames{1}, ParamNames{2}};
0091         NOT_USED_PARAM_ORDER = [1 0];
0092     else
0093         NOT_USED_PARAM_NAMES = {};
0094         NOT_USED_PARAM_ORDER = [];
0095     end
0096 
0097     if NbParam>5
0098         SET_PARAM_NAMES = {ParamNames{3}, ParamNames{4}, ParamNames{5}, ParamNames{6}};
0099         if command(3)
0100             SET_PARAM_VALUES_ORDER = [1 1 0 0];
0101         elseif command(4)
0102             SET_PARAM_VALUES_ORDER = 'ALL';
0103         else
0104             SET_PARAM_VALUES_ORDER = 'NO';
0105         end
0106         if command(5)
0107             SET_PARAM_SIGMAS_ORDER = [1 0 1 0];
0108         elseif command(6)
0109             SET_PARAM_SIGMAS_ORDER = 'ALL';
0110         else
0111             SET_PARAM_SIGMAS_ORDER = 'NO';
0112         end
0113     else
0114         SET_PARAM_NAMES = {};
0115         if command(3)
0116             SET_PARAM_VALUES_ORDER = [];
0117         elseif command(4)
0118             SET_PARAM_VALUES_ORDER = 'ALL';
0119         else
0120             SET_PARAM_VALUES_ORDER = 'NO';
0121         end
0122         if command(5)
0123             SET_PARAM_SIGMAS_ORDER = [];
0124         elseif command(6)
0125             SET_PARAM_SIGMAS_ORDER = 'ALL';
0126         else
0127             SET_PARAM_SIGMAS_ORDER = 'NO';
0128         end
0129     end
0130     SET_PARAM_VALUES = randn(1,length(SET_PARAM_NAMES));
0131     SET_PARAM_SIGMAS = 0.1*rand(1,length(SET_PARAM_NAMES));
0132 
0133     if NbParam>10
0134         JAC_PARAM_NAMES = {ParamNames{4}, ParamNames{5}, ParamNames{7}, ParamNames{8}, ParamNames{9}, ParamNames{10}};
0135         if command(5)
0136             JAC_PARAM_ORDER = [1 0 1 1 0 0];
0137         elseif command(6)
0138             JAC_PARAM_ORDER = 'ALL';
0139         else
0140             JAC_PARAM_ORDER = 'NO';
0141         end
0142     else
0143         JAC_PARAM_NAMES = {};
0144         if command(5)
0145             JAC_PARAM_ORDER = [];
0146         elseif command(6)
0147             JAC_PARAM_ORDER = 'ALL';
0148         else
0149             JAC_PARAM_ORDER = 'NO';
0150         end
0151     end
0152     if NbParam>10
0153         HESS_PARAM_NAMES = {ParamNames{4}, ParamNames{5}, ParamNames{7}, ParamNames{8}, ParamNames{9}, ParamNames{10}};
0154         if command(7)
0155             HESS_PARAM_ORDER = [1 0 1 0 1 0];
0156         elseif command(8)
0157             HESS_PARAM_ORDER = 'ALL';
0158         else
0159             HESS_PARAM_ORDER = 'NO';
0160         end
0161     else
0162         HESS_PARAM_NAMES = {};
0163         if command(9)
0164             HESS_PARAM_ORDER = [];
0165         elseif command(10)
0166             HESS_PARAM_ORDER = 'ALL';
0167         else
0168             HESS_PARAM_ORDER = 'NO';
0169         end
0170     end
0171     SYMBOLIC_OUTPUT_ALLOWED = command(11);
0172     options = plist( 'NOT_USED_PARAM_NAMES' , NOT_USED_PARAM_NAMES , 'NOT_USED_PARAM_ORDER' , NOT_USED_PARAM_ORDER , ...
0173         'SET_PARAM_NAMES' , SET_PARAM_NAMES , 'SET_PARAM_VALUES' , SET_PARAM_VALUES , 'SET_PARAM_SIGMAS' , SET_PARAM_SIGMAS , ...
0174         'SET_PARAM_VALUES_ORDER', SET_PARAM_VALUES_ORDER , 'SET_PARAM_SIGMAS_ORDER' , SET_PARAM_SIGMAS_ORDER , ...
0175         'JAC_PARAM_NAMES' , JAC_PARAM_NAMES ,  'JAC_PARAM_ORDER', JAC_PARAM_ORDER , ...
0176         'HESS_PARAM_NAMES' , HESS_PARAM_NAMES ,  'HESS_PARAM_ORDER', HESS_PARAM_ORDER , ...
0177         'SYMBOLIC_OUTPUT_ALLOWED', SYMBOLIC_OUTPUT_ALLOWED);
0178     options = [options, options]; %#ok<AGROW>
0179     syst = [syst syst]; %#ok<AGROW>
0180 %% launching function
0181     try
0182         subsys = ltpda_ss_modify(syst,options); 
0183         display('OK')
0184     catch
0185         display('FAIL')
0186         result = 0;
0187     end
0188 
0189 
0190 end
0191 varargout = {result};
0192 end
0193

Generated on Mon 31-Mar-2008 12:20:24 by m2html © 2003