home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 7.ddi / ROBUST.DI$ / BILIN.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  3.0 KB  |  113 lines

  1. function [AB,BB,CB,DB] = bilin(Z1,Z2,Z3,Z4,Z5,Z6,Z7)
  2. % [SS_B] = BILIN(SS_,VERS,TYPE,AUG) or
  3. % [AB,BB,CB,DB] = BILIN(A,B,C,D,VERS,TYPE,AUG) performs a frequency
  4. %      plane bilinear transform:
  5. %          az + d                           d - bs
  6. %    s = ---------  (if vers = 1); or z = ----------  (if vers = -1)
  7. %          cz + b                           cs - a
  8. %   such that
  9. %                    -1                                -1
  10. %       G(s) = C(Is-A) B + D <-------> G(z) = Cb(Iz-Ab)  Bb + Db       
  11. % --------------------------------------------------------------------------
  12. %   'Tustin' ----- Tustin Transform (s = 2(z-1)/T(z+1), aug = T).
  13. %   'P_Tust' ----- Prewarped Tustin (s = w0(z-1)/tan(w0*T/2)(z+1),
  14. %                                  aug = (T,w0), w0:prewarped freq.)
  15. %   'BwdRec' ----- Backward Rectangular (s = (z-1)/Tz, aug = T).
  16. %   'FwdRec' ----- Forward Rectangular (s = (z-1)/T, aug = T).
  17. %   'S_Tust' ----- Shifted Tustin (2(z-1)/T(z/sh+1), aug = (T,sh), 
  18. %                                sh: shifted circle coeff.).
  19. %   'Sft_jw' ----- Shifted jw-axis Bilinear (aug = (b1,a1), circle coeff.).
  20. %   'G_Bili' ----- General Bilinear (s = (az+d)/(cz+b), aug = (a,b,c,d)).
  21. % -------------------------------------------------------------------------
  22.  
  23. % R. Y. Chiang & M. G. Safonov 7/15/88
  24. % Copyright (c) 1988 by the MathWorks, Inc.
  25. % All Rights Reserved.
  26.  
  27. inargs = '(A,B,C,D,vers,Type,aug)';
  28. eval(mkargs(inargs,nargin,'ss'))
  29.  
  30. %
  31. % ---- Transform Identification :
  32. %
  33. if Type == 'Tustin'
  34.    T = aug;
  35.    if vers == 1
  36.       a = 2/T; b = 1; c = 1;  d = -a;
  37.    else
  38.       a = T/2; b = 1; c = -a; d = 1;
  39.    end
  40. end
  41. %
  42. if Type == 'P_Tust'
  43.    T = aug(1,1);
  44.    w0 = aug(1,2);
  45.    if vers == 1
  46.       a = w0/tan(w0*T/2); b = 1; c = 1;    d = -a;
  47.    else
  48.       a = tan(w0*T/2)/w0; b = 1; c = -a;   d = 1;
  49.    end
  50. end
  51. %
  52. if Type == 'BwdRec'
  53.    T = aug; 
  54.    if vers == 1
  55.       a = 1;    b = 0; c = T;    d = -1;
  56.    else
  57.       a = 0;    b = 1; c = -T;   d = 1;
  58.    end
  59. end
  60. %
  61. if Type == 'FwdRec'
  62.    T = aug;
  63.    if vers == 1
  64.       a = 1;   b = T; c = 0;     d = -1;
  65.    else
  66.       a = T;  b = 1;  c = 0;     d = 1;
  67.  
  68.    end
  69. end
  70. %
  71. if Type == 'S_Tust'
  72.    T = aug(1,1);
  73.    sh = aug(1,2);
  74.    if vers == 1
  75.       a = 2/T; b = 1; d = -a; c = 1/sh;
  76.    else
  77.       a = 1; b = 2/T; c = -1/sh; d = b;
  78.    end 
  79. end
  80. %
  81. if Type == 'Sft_jw'
  82.    xx = aug;
  83.    if vers == 1
  84.       a = 1; b = 1; c = 1/xx(1,1); d = xx(1,2);
  85.    else
  86.       a = -1; b = -1; c = 1/xx(1,1); d = xx(1,2);
  87.    end
  88. end
  89. %
  90. if Type == 'G_Bili'
  91.    xx = aug;
  92.    if vers == 1
  93.       a = xx(1,1); b = xx(1,2); c = xx(1,3);, d = xx(1,4);
  94.    else
  95.       a = -xx(1,2); b = -xx(1,1); c = xx(1,3); d = xx(1,4);
  96.    end
  97. end
  98. %
  99. % ---- State-Space Representation :
  100. %
  101. [ra,ca] = size(A);
  102. iidd = inv(a*eye(ra)-c*A);
  103. AB = (b*A-d*eye(ra))*iidd;
  104. BB = (a*b-c*d)*iidd*B;
  105. CB = C*iidd;
  106. DB = D + c*C*iidd*B;
  107. %
  108. if xsflag
  109.    AB = mksys(AB,BB,CB,DB);
  110. end
  111. %
  112. % ------- End of BILIN.M --- RYC/MGS 7/15/1987 ---%
  113.