Mu Analysis and Synthesis Toolbox | ![]() ![]() |
Pack and unpack a VARYING matrix and convert from a VARYING matrix to a CONSTANT
Syntax
matout = vpck(matin,indv) [varydata,rowpoint,indv,err] = vunpck(mat) [matout,ivval] = var2con(mat,desiv)
Description
The data structure for a VARYING matrix consists of the sampled matrix values stacked one upon each other, and the particular independent variable values. vpck
places the stacked data from the input variable, matin
, and the vector, indv
, which represents the independent variable values, into a new matrix, matout
, with the correct structure and data structure of a VARYING matrix.
The command vunpck
performs the inverse operation; unpacking a VARYING matrix into stacked data varydata
, row pointers rowpoint
, a vector of independent variables indv
, and an error flag err
. The value of rowpoint(i)
points to the row of data that corresponds to the first row of the ith value of matin
. indv
is a column vector with the independent variable values. The error flag is normally 0 but it is set to 1 if the input matrix is a SYSTEM.
var2con
converts VARYING matrices to CONSTANT matrices. If there is one input argument, mat
, and it is a VARYING matrix, then the output matout
is the CONSTANT matrix in mat
associated with the independent variable's first value. The optional second output argument is this independent variable's value. If two input arguments are used, then the first is a VARYING matrix, and the second is a desired independent variable's value. The command finds the matrix in mat
whose independent variable's value is closest to desiv
, and returns this matrix as a CONSTANT matrix.
Examples
Construct a VARYING matrix from a CONSTANT matrix and a vector of independent variables.
disp(matin) 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 time = [.1 2.3 5.6]'; disp(time) 1.0000e-01 2.3000e+00 5.6000e+00 matout = vpck(matin,time); see(matout) 2 rows 3 columns iv = 0.1 1 1 1 2 2 2 iv = 2.3 3 3 3 4 4 4 iv = 5.6 5 5 5 6 6 6
See Also
pck
, unpck
, xtract
, xtracti
![]() | vldiv, vpinv, vrdiv | vplot | ![]() |