Home > m > timetools > statespacefunctions > ltpda_ss_iir2ss.m

ltpda_ss_iir2ss

PURPOSE ^

ltpda_miir2ss converts a iir filter model into a subsystem.

SYNOPSIS ^

function varargout = ltpda_ss_iir2ss(varargin)

DESCRIPTION ^

 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_iir2ss.m,v 1.1 2008/02/25 12:43:44 adrien 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
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = ltpda_ss_iir2ss(varargin)
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_iir2ss.m,v 1.1 2008/02/25 12:43:44 adrien 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_iir2ss.m,v 1.1 2008/02/25 12:43:44 adrien Exp $';
0054 CATEGORY = 'STATESPACE';
0055 display(['starting ' ALGONAME]);
0056 
0057 if isequal( varargin{1}, 'Version')
0058     varargout = VERSION;
0059     return;
0060 elseif isequal(varargin{1}, 'Params')
0061     varargout = plist();
0062     return;
0063 elseif isequal(varargin{1}, 'Category')
0064     varargout = CATEGORY;
0065     return;
0066 end
0067 
0068 
0069 iir = varargin{1};
0070 
0071 a = iir.a;
0072 b = iir.b;
0073     
0074 % for next part check must be made there is no pole zero cancelation
0075 nss = size(b,2)-1;
0076 
0077 % is residue ok??
0078 [r,p,k] = residue(a,b); %!! here b are for the poles, a the zeros
0079 D = k;
0080 
0081 a = a/b(1);
0082 b = b/b(1);
0083 
0084 
0085 A =  [zeros(nss-1,1) eye(nss-1); b(2:length(b))];
0086 B = [zeros(nss-1,1) ;1];
0087 C = a;
0088 
0089 
0090 varargout = plist('TYPE', 'SUMBSYSTEM' ,'NAME', iir.name ,'TIMESTEP', 1/(iir.fs), ...
0091     'XISOUTPUT', 0,'YISOUTPUT',1,'XINI', zeros(nss,1) , ...
0092     'PARAMNAMES', {},'PARAMVALUES', [],'PARAMSIGMAS', [],...
0093     'NBINPUTS', iir.ntaps ,'INPUTNAMES', {'U_1'} ,'INPUTSIZES', 1 , 'INPUTISUSED', 1 ,...
0094     'AMAT', {A} ,'BMATS', {B} ,'CMAT', {C} ,'DMATS', {D} );
0095 
0096 ltpda_ss_check(subsys);
0097 end

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