3431
|
1 ## Copyright (C) 1996 Auburn University. All rights reserved. |
|
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 -*- |
3500
|
20 ## @deftypefn {Function File} {[@var{y}, @var{t}] =} step (@var{sys}, @var{inp}, @var{tstop}, @var{n}) |
3431
|
21 ## Step response for a linear system. |
|
22 ## The system can be discrete or multivariable (or both). |
|
23 ## If no output arguments are specified, @code{step} |
|
24 ## produces a plot or the step response data for system @var{sys}. |
|
25 ## |
|
26 ## @strong{Inputs} |
|
27 ## @table @var |
|
28 ## @item sys |
|
29 ## System data structure. |
|
30 ## @item inp |
|
31 ## Index of input being excited |
|
32 ## @item tstop |
|
33 ## The argument @var{tstop} (scalar value) denotes the time when the |
|
34 ## simulation should end. |
|
35 ## @item n |
|
36 ## the number of data values. |
|
37 ## |
|
38 ## Both parameters @var{tstop} and @var{n} can be omitted and will be |
|
39 ## computed from the eigenvalues of the A-Matrix. |
|
40 ## @end table |
|
41 ## @strong{Outputs} |
|
42 ## @var{y}, @var{t}: impulse response |
|
43 ## |
|
44 ## When invoked with the output paramter y the plot is not displayed. |
|
45 ## @end deftypefn |
3438
|
46 ## @seealso{impulse and __stepimp__} |
3431
|
47 |
|
48 ## Author: Kai P. Mueller <mueller@ifr.ing.tu-bs.de> |
|
49 ## Created: September 30, 1997 |
|
50 ## based on lsim.m of Scottedward Hodel |
|
51 |
|
52 function [y, t] = step (sys, inp, tstop, n) |
|
53 |
3438
|
54 if ((nargin < 1) || (nargin > 4)) |
|
55 usage ("[y, u] = step(sys, inp, tstop, n)"); |
3431
|
56 endif |
|
57 |
3438
|
58 if (nargout > 2) |
|
59 usage ("[y, u] = step (sys, inp, tstop, n)"); |
3431
|
60 endif |
|
61 |
3438
|
62 if (! is_struct (sys)) |
|
63 error ("step: sys must be a system data structure."); |
3431
|
64 endif |
|
65 |
|
66 if (nargout == 0) |
|
67 switch (nargin) |
|
68 case (1) |
3438
|
69 __stepimp__ (1, sys); |
3431
|
70 case (2) |
3438
|
71 __stepimp__ (1, sys, inp); |
3431
|
72 case (3) |
3438
|
73 __stepimp__ (1, sys, inp, tstop); |
3431
|
74 case (4) |
3438
|
75 __stepimp__ (1, sys, inp, tstop, n); |
3431
|
76 endswitch |
|
77 else |
|
78 switch (nargin) |
|
79 case (1) |
3438
|
80 [y, t] = __stepimp__ (1, sys); |
3431
|
81 case (2) |
3438
|
82 [y, t] = __stepimp__ (1, sys, inp); |
3431
|
83 case (3) |
3438
|
84 [y, t] = __stepimp__ (1, sys, inp, tstop); |
3431
|
85 case (4) |
3438
|
86 [y, t] = __stepimp__ (1, sys, inp, tstop, n); |
3431
|
87 endswitch |
|
88 endif |
|
89 |
|
90 endfunction |