[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Construction and manipulations of the OCST system data structure (see section System Data Structure) requires attention to many details in order to ensure that data structure contents remain consistent. Users are strongly encouraged to use the system interface functions in this section. Functions for the formatted display in of system data structures are given in System display functions.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
construct a system data structure from FIR description
Inputs
vector of coefficients of the SISO FIR transfer function
sampling time (default: 1)
name of input signal; may be a string or a list with a single entry.
name of output signal; may be a string or a list with a single entry.
Output
system data structure
Example
octave:1> sys = fir2sys([1 -1 2 4],0.342,\ > "A/D input","filter output"); octave:2> sysout(sys) Input(s) 1: A/D input Output(s): 1: filter output (discrete) Sampling interval: 0.342 transfer function form: 1*z^3 - 1*z^2 + 2*z^1 + 4 ------------------------- 1*z^3 + 0*z^2 + 0*z^1 + 0 |
Extract FIR data from system data structure; see fir2sys
for
parameter descriptions.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Create system structure from state-space data. May be continous, discrete, or mixed (sampled data)
Inputs
usual state space matrices.
default: d = zero matrix
sampling rate. Default: tsam = 0 (continuous system)
number of continuous, discrete states in the system
If tsam is 0, n = rows
(a), nz = 0.
If tsam is greater than zero, n = 0,
nz = rows
(a)
see below for system partitioning
cell array of strings of state signal names
default (stname=[] on input): x_n
for continuous states,
xd_n
for discrete states
cell array of strings of input signal names
default (inname = [] on input): u_n
cell array of strings of input signal names
default (outname = [] on input): y_n
list of indices of outputs y that are sampled
If tsam is 0, outlist = [].
If tsam is greater than 0, outlist = 1:rows
(c).
Unlike states, discrete/continous outputs may appear in any order.
sys2ss
returns a vector yd where
yd(outlist) = 1; all other entries of yd are 0.
Outputs outsys = system data structure
System partitioning
Suppose for simplicity that outlist specified that the first several outputs were continuous and the remaining outputs were discrete. Then the system is partitioned as
x = [ xc ] (n x 1) [ xd ] (nz x 1 discrete states) a = [ acc acd ] b = [ bc ] [ adc add ] [ bd ] c = [ ccc ccd ] d = [ dc ] [ cdc cdd ] [ dd ] (cdc = c(outlist,1:n), etc.) |
with dynamic equations:
Signal partitions
| continuous | discrete | ---------------------------------------------------- states | stname(1:n,:) | stname((n+1):(n+nz),:) | ---------------------------------------------------- outputs | outname(cout,:) | outname(outlist,:) | ---------------------------------------------------- |
where cout is the list of in 1:rows
(p)
that are not contained in outlist. (Discrete/continuous outputs
may be entered in any order desired by the user.)
Example
octave:1> a = [1 2 3; 4 5 6; 7 8 10]; octave:2> b = [0 0 ; 0 1 ; 1 0]; octave:3> c = eye (3); octave:4> sys = ss (a, b, c, [], 0, 3, 0, {"volts", "amps", "joules"}); octave:5> sysout(sys); Input(s) 1: u_1 2: u_2 Output(s): 1: y_1 2: y_2 3: y_3 state-space form: 3 continuous states, 0 discrete states State(s): 1: volts 2: amps 3: joules A matrix: 3 x 3 1 2 3 4 5 6 7 8 10 B matrix: 3 x 2 0 0 0 1 1 0 C matrix: 3 x 3 1 0 0 0 1 0 0 0 1 D matrix: 3 x 3 0 0 0 0 0 0 |
Notice that the D matrix is constructed by default to the correct dimensions. Default input and output signals names were assigned since none were given.
Extract state space representation from system data structure.
Input
System data structure.
Outputs
State space matrices for sys.
Sampling time of sys (0 if continuous).
Number of continuous, discrete states (discrete states come last in state vector x).
Signal names (lists of strings); names of states, inputs, and outputs, respectively.
Binary vector; yd(ii) is 1 if output y(ii) is discrete (sampled); otherwise yd(ii) is 0.
A warning massage is printed if the system is a mixed continuous and discrete system.
Example
octave:1> sys=tf2sys([1 2],[3 4 5]); octave:2> [a,b,c,d] = sys2ss(sys) a = 0.00000 1.00000 -1.66667 -1.33333 b = 0 1 c = 0.66667 0.33333 d = 0 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Build system data structure from transfer function format data.
Inputs
Coefficients of numerator/denominator polynomials.
Sampling interval; default: 0 (continuous time).
Input/output signal names; may be a string or cell array with a single string entry.
Output
System data structure.
Example
octave:1> sys=tf2sys([2 1],[1 2 1],0.1); octave:2> sysout(sys) Input(s) 1: u_1 Output(s): 1: y_1 (discrete) Sampling interval: 0.1 transfer function form: 2*z^1 + 1 ----------------- 1*z^2 + 2*z^1 + 1 |
Extract transfer function data from a system data structure.
See tf
for parameter descriptions.
Example
octave:1> sys=ss([1 -2; -1.1,-2.1],[0;1],[1 1]); octave:2> [num,den] = sys2tf(sys) num = 1.0000 -3.0000 den = 1.0000 1.1000 -4.3000 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Create system data structure from zero-pole data.
Inputs
Vector of system zeros.
Vector of system poles.
Scalar leading coefficient.
Sampling period; default: 0 (continuous system).
Input/output signal names (lists of strings).
Output
System data structure.
Example
octave:1> sys=zp2sys([1 -1],[-2 -2 0],1); octave:2> sysout(sys) Input(s) 1: u_1 Output(s): 1: y_1 zero-pole form: 1 (s - 1) (s + 1) ----------------- s (s + 2) (s + 2) |
Extract zero/pole/leading coefficient information from a system data structure.
See zp
for parameter descriptions.
Example
octave:1> sys=ss([1 -2; -1.1,-2.1],[0;1],[1 1]); octave:2> [zer,pol,k] = sys2zp(sys) zer = 3.0000 pol = -2.6953 1.5953 k = 1 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Superseded by syssetsignals
.
This function changes the sampling time (tsam) of the system. Exits with an error if sys is purely continuous time.
return the number of states, inputs, and/or outputs in the system sys.
Inputs
system data structure
String indicating which dimensions are desired. Values:
"all"
(default) return all parameters as specified under Outputs below.
"cst"
return n= number of continuous states
"dst"
return n= number of discrete states
"in"
return n= number of inputs
"out"
return n= number of outputs
Outputs
number of continuous states (or individual requested dimension as specified by opt).
number of discrete states
number of system inputs
number of system outputs
binary vector; yd(ii) is nonzero if output ii is discrete. yd(ii) = 0 if output ii is continous
Get signal names from a system
Inputs
system data structure for the state space system
signal id. String. Must be one of
"in"
input signals
"out"
output signals
"st"
stage signals
"yd"
value of logical vector yd
index(indices) or name(s) or signals; see sysidx
flag to return a string instead of a cell array; Values:
0
(default) return a cell array (even if signum specifies an individual signal)
1
return a string. Exits with an error if signum does not specify an individual signal.
Outputs
signal names (cell array of strings); names of states, inputs, and outputs, respectively.
binary vector; yd(ii) is nonzero if output ii is discrete.
sigid="in"
siglist is set to the cell array of input names.
sigid="out"
siglist is set to the cell array of output names.
sigid="st"
siglist is set to the cell array of state names.
stage signals
sigid="yd"
siglist is set to logical vector indicating discrete outputs; siglist(ii) = 0 indicates that output ii is continuous (unsampled), otherwise it is discrete.
signame is a cell array of the specified signal names (sigid is
"in"
, "out"
, or "st"
), or else the logical flag
indicating whether output(s) signum is(are) discrete (sigval=1)
or continuous (sigval=0).
Examples (From sysrepdemo
)
octave> sys=ss(rand(4),rand(4,2),rand(3,4)); octave># get all signal names octave> [Ast,Ain,Aout,Ayd] = sysgetsignals(sys) Ast = ( [1] = x_1 [2] = x_2 [3] = x_3 [4] = x_4 ) Ain = ( [1] = u_1 [2] = u_2 ) Aout = ( [1] = y_1 [2] = y_2 [3] = y_3 ) Ayd = 0 0 0 octave> # get only input signal names: octave> Ain = sysgetsignals(sys,"in") Ain = ( [1] = u_1 [2] = u_2 ) octave> # get name of output 2 (in cell array): octave> Aout = sysgetsignals(sys,"out",2) Aout = ( [1] = y_2 ) octave> # get name of output 2 (as string): octave> Aout = sysgetsignals(sys,"out",2,1) Aout = y_2 |
return the initial system type of the system
Input
System data structure.
Output
String indicating how the structure was initially
constructed. Values: "ss"
, "zp"
, or "tf"
.
FIR initialized systems return systype="tf"
.
change the names of selected inputs, outputs and states.
Inputs
System data structure.
Change default name (output).
"out"
Change selected output names.
"in"
Change selected input names.
"st"
Change selected state names.
"yd"
Change selected outputs from discrete to continuous or from continuous to discrete.
opt = "out", "in", "st"
string or string array containing desired signal names or values.
opt = "yd"
To desired output continuous/discrete flag. Set name to 0 for continuous, or 1 for discrete.
indices or names of outputs, yd, inputs, or states whose respective names/values should be changed.
Default: replace entire cell array of names/entire yd vector.
Outputs
sys with appropriate signal names changed (or yd values, where appropriate).
Example
octave:1> sys=ss([1 2; 3 4],[5;6],[7 8]); octave:2> sys = syssetsignals(sys,"st",str2mat("Posx","Velx")); octave:3> sysout(sys) Input(s) 1: u_1 Output(s): 1: y_1 state-space form: 2 continuous states, 0 discrete states State(s): 1: Posx 2: Velx A matrix: 2 x 2 1 2 3 4 B matrix: 2 x 1 5 6 C matrix: 1 x 2 7 8 D matrix: 1 x 1 0 |
Update the internal representation of a system.
Inputs
system data structure
string:
"tf"
update transfer function form
"zp"
update zero-pole form
"ss"
update state space form
"all"
all of the above
Outputs
Contains union of data in sys and requested data. If requested data in sys is already up to date then retsys=sys.
Conversion to tf
or zp
exits with an error if the system is
mixed continuous/digital.
Determines the type of system matrix. inmat can be a varying, a system, a constant, and an empty matrix.
Outputs
Can be one of: varying, system, constant, and empty.
The number of outputs of the system.
The number of inputs of the system.
The number of continuous states of the system.
The number of discrete states of the system.
Return the sampling time of the system sys.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated on July, 20 2006 using texi2html 1.76.