Home > m > timetools > statespacefunctions > utp_ltpda_ss_modify_time_setup.m

utp_ltpda_ss_modify_time_setup

PURPOSE ^

tests ltpda_ss_modify_time_setup with both syntaxic and numerical test.

SYNOPSIS ^

function output = utp_ltpda_ss_modify_time_setup

DESCRIPTION ^

 tests ltpda_ss_modify_time_setup with both syntaxic and numerical test.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DESCRIPTION: test function for ltpda_ss_modify_time_setup 

 CALL: utp_ltpda_ss_modify_time_setup

 INPUTS: 
 
 OUTPUTS: 1/0
 
 VERSION: '$Id: utp_ltpda_ss_modify_time_setup.m,v 1.2 2008/02/20 09:20:07 adrien Exp $'

 HISTORY: 07-02-2008 A Grynagier

 to do : modify for noise shape filter case or HF inputs with aliasing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% standard calls for LTPDA function data

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function output = utp_ltpda_ss_modify_time_setup
0002 % tests ltpda_ss_modify_time_setup with both syntaxic and numerical test.
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % DESCRIPTION: test function for ltpda_ss_modify_time_setup
0005 %
0006 % CALL: utp_ltpda_ss_modify_time_setup
0007 %
0008 % INPUTS:
0009 %
0010 % OUTPUTS: 1/0
0011 %
0012 % VERSION: '$Id: utp_ltpda_ss_modify_time_setup.m,v 1.2 2008/02/20 09:20:07 adrien Exp $'
0013 %
0014 % HISTORY: 07-02-2008 A Grynagier
0015 %
0016 % to do : modify for noise shape filter case or HF inputs with aliasing
0017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0018 %% standard calls for LTPDA function data
0019 
0020 ALGONAME = mfilename;
0021 VERSION = '$Id: utp_ltpda_ss_modify_time_setup.m,v 1.2 2008/02/20 09:20:07 adrien Exp $';
0022 display(['starting ' mfilename]);
0023 output =1;
0024 
0025 for i=1:100
0026     nSysTot = 1;
0027     pSys = 1;
0028     nUTot = floor(rand()*4);
0029     OutputSizes = floor(rand()*4);
0030     InputSizes = floor(rand(nUTot)*4);
0031     try
0032         j = 1;
0033         syst0 = utp_ltpda_ss_random_generate(nSysTot, pSys, nUTot, OutputSizes, InputSizes);
0034         AMAT = find(syst0, 'AMAT');
0035         V = max(0.5 , max(abs(imag(eig(AMAT{1})))));
0036         if size(V,1)==0
0037             V = 1;
0038         end
0039         Tmax = 3.1415/V/2; % max timestep to ensure no aliasing is happening
0040         %     syst0 = pset(syst0, 'AMAT', {eye(size(AMAT{1},1))} );
0041 
0042         NewTimeStep = plist('TIMESTEP',Tmax*0.05);
0043         j = j+1;
0044         syst2 = ltpda_ss_modify_time_setup(syst0,NewTimeStep);
0045 
0046         NewTimeStep = plist('TIMESTEP',0.5*Tmax);
0047         j = j+1;
0048         syst3 = ltpda_ss_modify_time_setup(syst2,NewTimeStep);
0049 
0050         NewTimeStep = plist('TIMESTEP',0.05*Tmax);
0051         j = j+1;
0052         syst4 = ltpda_ss_modify_time_setup(syst3,NewTimeStep);
0053 
0054         NewTimeStep = plist('TIMESTEP',0);
0055         j = j+1;
0056         syst5 = ltpda_ss_modify_time_setup(syst4,NewTimeStep);
0057         display('ok')
0058     catch
0059         display(['error at step ' num2str(j)])
0060         output = 0;
0061         display('pb')
0062     end
0063 
0064     %% checking syst2 and sys4 are equal, also for syst0 and syst5
0065     AMAT2 = find(syst2,'AMAT');
0066     AMAT4 = find(syst4,'AMAT');
0067     AMAT0 = find(syst0,'AMAT');
0068     AMAT5 = find(syst5,'AMAT');
0069 %     BMATS2 = find(syst2,'BMATS');
0070 %     BMATS4 = find(syst4,'BMATS');
0071 %     BMATS0 = find(syst0,'BMATS');
0072 %     BMATS5 = find(syst5,'BMATS');
0073 %     CMAT2 = find(syst2,'CMAT');
0074 %     CMAT4 = find(syst4,'CMAT');
0075 %     CMAT0 = find(syst0,'CMAT');
0076 %     CMAT5 = find(syst5,'CMAT');
0077     if not( norm(AMAT2{1}-AMAT4{1})<5e-7)
0078         display('error possible when changing time between discrete and discrete')
0079         output = 0;
0080     end
0081     if not(norm(AMAT0{1}-AMAT5{1})<5e-7)
0082         display('error possible when changing time between continuous and discrete')
0083         output = 0;
0084     end
0085     if not(norm(AMAT2{1}-AMAT4{1})<1e-13)
0086         display(['small error when changing time between discrete and discrete :' num2str(norm(AMAT2{1}-AMAT4{1}))])
0087     end
0088     if not(norm(AMAT0{1}-AMAT5{1})<1e-13)
0089         display(['small error when changing time between continuous and discrete : ' num2str(norm(AMAT0{1}-AMAT5{1}))])
0090     end
0091 end
0092 end

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