home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fb.zip / octave / SCRIPTS.ZIP / scripts / control / ord2.m < prev    next >
Encoding:
Text File  |  1999-12-15  |  2.2 KB  |  63 lines

  1. ## Copyright (C) 1997 Kai P. Mueller
  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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. 
  18.  
  19. ## -*- texinfo -*-
  20. ## @deftypefn {Function File } { @var{outsys} =} ord2 (@var{nfreq}, @var{damp}@{[, @var{gain}@})
  21. ##  Creates a continuous 2nd order system with parameters:
  22. ## @strong{Inputs}
  23. ## @table @var
  24. ## @item  nfreq:   natural frequency [Hz]. (not in rad/s)
  25. ## @item      damp:    damping coefficient
  26. ## @item      gain:    dc-gain
  27. ##                This is steady state value only for damp > 0.
  28. ##                gain is assumed to be 1.0 if ommitted.
  29. ## @end table
  30. ## @strong{Outputs}
  31. ## @var{outsys}
  32. ##       system data structure has representation with @math{w = 2 * pi * nfreq}:
  33. ## @example
  34. ##     /                                        \
  35. ##     | / -2w*damp -w \  / w \                 |
  36. ## G = | |             |, |   |, [ 0  gain ], 0 |
  37. ##     | \   w       0 /  \ 0 /                 |
  38. ##     \                                        /
  39. ## @end example
  40. ## @strong{See also} @code{jet707} (MIMO example, Boeing 707-321 aircraft model)
  41. ## @end deftypefn
  42.  
  43. ## See also: jet707 (MIMO example, Boeing 707-321 aircraft model)
  44.  
  45. function outsys = ord2 (nfreq, damp, gain)
  46.  
  47.   ## Written by Kai P. Mueller September 28, 1997
  48.   ## Updates
  49.  
  50.   if(nargin != 2 & nargin != 3)
  51.     usage("outsys = ord2(nfreq, damp[, gain])")
  52.   endif
  53.   if (nargout > 1)
  54.     usage("outsys = ord2(nfreq, damp[, gain])")
  55.   endif
  56.   if (nargin == 2)
  57.     gain = 1.0;
  58.   endif
  59.  
  60.   w = 2.0 * pi * nfreq;
  61.   outsys = ss2sys([-2.0*w*damp, -w; w, 0], [w; 0], [0, gain]);
  62. endfunction
  63.