ltpda_miir2ss converts a iir filter model into a subsystem. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: ltpda_miir2ss converts a iir filter model into a subsystem. Right now the new state space is written in the cannonincal controllable form, and has - of course - only one input. For intellignent conversion to state space models, it is advised to make use of pzm2ss which computes the state space in the jordan form of A. A version calling for use of 'residue' function was not used due to numerical error concerns. CALL: subsys = ltpda_miir2ss(iir) INPUTS: iir - an infinite inpulsr response model object 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_miir2ss.html,v 1.1 2008/03/01 12:29:32 hewitson Exp $ HISTORY: 8-02-2008 A Grynagier 7-02-2008 A Grynagier 2-02-2008 A Grynagier TO DO : possibly add the jordan block option %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function subsys = ltpda_ss_miir2ss(iir) 0002 % ltpda_miir2ss converts a iir filter model into a subsystem. 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % DESCRIPTION: ltpda_miir2ss converts a iir filter model into a subsystem. 0006 % Right now the new state space is written in the cannonincal controllable 0007 % form, and has - of course - only one input. 0008 % For intellignent conversion to state space models, it is advised to 0009 % make use of pzm2ss which computes the state space in the jordan form of 0010 % A. 0011 % A version calling for use of 'residue' function was not used due to 0012 % numerical error concerns. 0013 % 0014 % CALL: subsys = ltpda_miir2ss(iir) 0015 % 0016 % INPUTS: iir - an infinite inpulsr response model object 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_miir2ss.html,v 1.1 2008/03/01 12:29:32 hewitson Exp $ 0043 % 0044 % HISTORY: 8-02-2008 A Grynagier 0045 % 7-02-2008 A Grynagier 0046 % 2-02-2008 A Grynagier 0047 % 0048 % TO DO : possibly add the jordan block option 0049 % 0050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0051 0052 ALGONAME = mfilename; 0053 VERSION = '$$Id: ltpda_ss_miir2ss.html,v 1.1 2008/03/01 12:29:32 hewitson Exp $'; 0054 display(['starting ' mfilename]); 0055 0056 a = iir.a; 0057 b = iir.b; 0058 0059 % for next part check must be made there is no pole zero cancelation 0060 nss = size(b,2)-1; 0061 0062 % is residue ok?? 0063 [r,p,k] = residue(a,b); %!! here b are for the poles, a the zeros 0064 D = k; 0065 0066 a = a/b(1); 0067 b = b/b(1); 0068 0069 0070 A = [zeros(nss-1,1) eye(nss-1); b(2:length(b))]; 0071 B = [zeros(nss-1,1) ;1]; 0072 C = a; 0073 0074 0075 subsys = plist('TYPE', 'SUMBSYSTEM' ,'NAME', iir.name ,'TIMESTEP', 1/(iir.fs), ... 0076 'XISOUTPUT', 0,'YISOUTPUT',1,'XINI', zeros(nss,1) , ... 0077 'PARAMNAMES', {},'PARAMVALUES', [],'PARAMSIGMAS', [],... 0078 'NBINPUTS', iir.ntaps ,'INPUTNAMES', {'U_1'} ,'INPUTSIZES', [1] , 'INPUTISUSED', [1] ,... 0079 'AMAT', {A} ,'BMATS', {B} ,'CMAT', {C} ,'DMATS', {D} ); 0080 0081 ltpda_ss_check(subsys); 0082 end