File: minfo.m

package info (click to toggle)
octave-control 1.0.11-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,628 kB
  • ctags: 160
  • sloc: makefile: 64; sh: 4
file content (94 lines) | stat: -rw-r--r-- 2,732 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
## Copyright (C) 1996, 2000, 2004, 2005, 2007
##               Auburn University.  All rights reserved.
##
##
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or (at
## your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; see the file COPYING.  If not, see
## <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn {Function File} {[@var{systype}, @var{nout}, @var{nin}, @var{ncstates}, @var{ndstates}] =} minfo (@var{inmat})
## Determines the type of system matrix.  @var{inmat} can be a varying, 
## a system, a constant, and an empty matrix.
##
## @strong{Outputs}
## @table @var
## @item systype 
## Can be one of: varying, system, constant, and empty.
## @item nout 
## The number of outputs of the system.
## @item nin
## The number of inputs of the system.
## @item ncstates
## The number of continuous states of the system.
## @item ndstates 
## The number of discrete states of the system.
## @end table
## @end deftypefn

## Author: R. Bruce Tenison <btenison@eng.auburn.edu>
## Created: July 29, 1994
## Modified by David Clem November 13, 1994
## Modified by A. S. Hodel July 1995

function [systype, nout, nin, ncstates, ndstates] = minfo (inmat)

  warning ("minfo: obsolete.  Use sys2ss, sys2tf, or sys2zp.");

  if (nargin != 1 )
    disp ("MINFO: Wrong number of arguments")
    systype = nout = nin = ncstates = ndstates = [];
  endif

  [rr, cc] = size (inmat);

  ## Check for empty matrix first!
  if (isempty (inmat))
    systype = "empty";
    nout = nin = ncstates = ndstates = 0;
    return

  ## Check for Constant matrix

  elseif (rr == 1 || cc == 1)
    systype = "constant";
    nout = nin = ncstates = ndstates = 1;
    return

  ## Check for system type matrix
  elseif (inmat(rr,cc) == -Inf)
    systype = "system";
    ncstates = inmat(1,cc);
    ndstates = inmat(rr,1);
    nstates = ncstates + ndstates;
    nout = rr - nstates - 1;
    nin = cc - nstates - 1;

  ## Check for Varying type matrix
  elseif (inmat(rr,cc) == Inf)
    systype = "varying";
    npoints = inmat(rr,cc-1);
    nin = cc - 1;
    nout = rr / npoints;
    nstates = 0;

    ## Must be a standard matrix
  else
    systype = "constant";
    nin = cc;
    nout = rr;
    ncstates = 0;
    ndstates = 0;
  endif

endfunction