


test conversion from state-space to pole zero model %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: test conversion from state-space to pole zero model CALL: utp_ltpda_ss_pz2ss INPUTS: none OUTPUTS: 1/0 ***** THERE ARE NO DEFAULT PARAMETERS ***** VERSION: $Id: utp_ltpda_ss_pz2ss.m,v 1.2 2008/02/20 09:20:07 adrien Exp $ HISTORY: 22-01-2008 A Grynagier TO DO : syntaxic (and more numerical tests), consider the jordan bloc/partial fraction expansion case for higher precision, or possibly the use of the vpa function. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


0001 function result = utp_ltpda_ss_pz2ss 0002 % test conversion from state-space to pole zero model 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % DESCRIPTION: test conversion from state-space to pole zero model 0006 % 0007 % CALL: utp_ltpda_ss_pz2ss 0008 % 0009 % INPUTS: none 0010 % 0011 % OUTPUTS: 1/0 0012 % 0013 % ***** THERE ARE NO DEFAULT PARAMETERS ***** 0014 % 0015 % VERSION: $Id: utp_ltpda_ss_pz2ss.m,v 1.2 2008/02/20 09:20:07 adrien Exp $ 0016 % 0017 % HISTORY: 22-01-2008 A Grynagier 0018 % 0019 % TO DO : syntaxic (and more numerical tests), consider the jordan bloc/partial 0020 % fraction expansion case for higher precision, or possibly the use of the 0021 % vpa function. 0022 % 0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 VERSION = '$Id: utp_ltpda_ss_pz2ss.m,v 1.2 2008/02/20 09:20:07 adrien Exp $'; 0025 display(['starting ' mfilename]); 0026 result = 1; 0027 % p = pzmodel(1,[pole(1) pole(2,2) pole(3) pole(4)], [zero(5) zero(6) zero(7)]); 0028 try 0029 p = pzmodel(1,pole(2/2/pi,1) , [zero(-1/2/pi) zero(-2/2/pi) ]); 0030 subsys = ltpda_ss_pz2ss(p); 0031 Amat = find(subsys, 'AMAT'); 0032 Bmats = find(subsys, 'BMATS'); 0033 Cmat = find(subsys, 'CMAT'); 0034 Dmats = find(subsys, 'DMATS'); 0035 A = Amat{1}; 0036 B = Bmats{1}; 0037 C = Cmat{1}; 0038 D = Dmats{1}; 0039 [a,b] = ss2tf(A,B,C,D); 0040 if (norm(A-[0 1; 2 3]) + norm(B-[0;1]) + norm(C-[2 -1]) + norm(D-1))>1e-14 0041 result = 0; 0042 end 0043 end 0044 if result ==1 0045 display('ok') 0046 else 0047 display('pb') 0048 end 0049 end