home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21eb.zip / octave / SCRIPTS.ZIP / scripts / control / mb.m < prev    next >
Text File  |  1999-03-05  |  2KB  |  63 lines

  1. # Copyright (C) 1996,1998 A. Scottedward Hodel
  2. #
  3. # This file is part of Octave.
  4. #
  5. # Octave is free software; you can redistribute it and/or modify it
  6. # under the terms of the GNU General Public License as published by the
  7. # Free Software Foundation; either version 2, or (at your option) any
  8. # later version.
  9. #
  10. # Octave is distributed in the hope that it will be useful, but WITHOUT
  11. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13. # for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with Octave; see the file COPYING.  If not, write to the Free
  17. # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. # I think that this m-file can be deleted
  20. # a.s.hodel@eng.auburn.edu - 4 Dec. 1998
  21.  
  22. Ap = [0, 1;1960, 0];
  23. Bp = [0;-6261];
  24. Cp = [1, 0];
  25. Dp = 0;
  26.  
  27. Gp = ss2sys(Ap,Bp,Cp,Dp,0,2,0,[],"delta_i","delta_y");
  28. Gp = syssetsignals(Gp,"st","delta_x1",1);
  29. Gp = syssetsignals(Gp,"st","delta_x2",2);
  30.  
  31. Ak = [-20, 1;-22160, -200];
  32. Bk = [-20;-2160];
  33. Ck = [-3.5074, -0.0319];
  34. Dk = 0;
  35.  
  36. Gk = ss2sys(Ak,Bk,Ck,Dk,0,2,0,[],"y","i");
  37. Gk = syssetsignals(Gk,"st","x1",1);
  38. Gk = syssetsignals(Gk,"st","x2",2);
  39.  
  40. Gc = sysgroup(Gp,Gk);
  41.  
  42. Gc = sysdup(Gc,[],[1, 2]);
  43. # Gc = sysscale(Gc,[],diag([1,1,1,1]));
  44.  
  45. Gc = sysconnect(Gc,[1, 2],[4, 3]);
  46. Gc = sysprune(Gc,1,[1, 2]);
  47.  
  48. disp("after pruning, closed loop system is")
  49. sysout(Gc)
  50.  
  51. # Gc = sysdup(Gc,[],2);
  52. # Gc = sysconnect(Gc,1,3);
  53. # Gc = sysprune(Gc,1,1);
  54.  
  55. is_stable(Gc)
  56. Gca = sys2ss(Gc);
  57. eig(Gca)
  58.  
  59. [Gpa,Gpb,Gpc,Gpd] = sys2ss(Gp);
  60. [Gka,Gkb,Gkc,Gkd] = sys2ss(Gk);
  61. Acl = [Gpa, -Gpb*Gkc; Gkb*Gpc, Gka]
  62. eig(Acl)
  63.