Mu Analysis and Synthesis Toolbox | ![]() ![]() |
Matrix assignment for VARYING and SYSTEM matrices
Syntax
out = massign(matin,rowindex,colindex,data)
Description
Performs a matrix assignment like operation on VARYING and SYSTEM matrices. It is functionally equivalent to:
matin(rowindex,colindex) = data
where rowindex
and colindex
are vectors specifying the rows and columns (or outputs and inputs if matin
is a SYSTEM) to be changed.
data
must either be a constant or of the same type as matin
. The dimensions of data
must be consistent with the lengths of rowindex
and colindex
.
Note: when applied to a SYSTEM, the result will almost always be nonminimal.
Examples
In the first example a VARYING matrix with two independent variables is formed with identical (and obvious) data for each matrix.
tl = [11,12,13,14; 21,22,23,24; 31,32,33,34; 41,42,43,44]; vmat = vpck([tl;tl],[0.1,0.2]);Now make a 2 x 2 data matrix and insert it into the VARYING matrix. Changing the order of the row and column indices has the effect of permuting the result. This is identical to the constant matrix case.
ri = [1,3]; ci = [4,2]; data = [0.001, 0.002; 0.003, 0.004]; vmatl = massign(vmat,ri,ci,data); see(vmatl) 4 rows 4 columns iv = 0.1 11.0000 0.0020 13.0000 0.0010 21.0000 22.0000 23.0000 24.0000 31.0000 0.0040 33.0000 0.0030 41.0000 42.0000 43.0000 44.0000 iv = 0.2 11.0000 0.0020 13.0000 0.0010 21.0000 22.0000 23.0000 24.0000 31.0000 0.0040 33.0000 0.0030 41.0000 42.0000 43.0000 44.0000In the following example part of a system is replaced by the
massign
function. The initial system is a diagonal system of first order lags. The 2,2 element is replaced by a lightly damped system and the result plotted. Note that the modified system is no longer minimal.
a = diag([1,2,-3,-4]); b = eye(4); c = diag([1,2,3,4]); sys = pck(a,b,c); subsys = nd2sys(1,[1,0.1,1]); sys = massign(sys,2,2,subsys); minfo(sys) system: 10 states 4 outputs4 inputs omega = logspace(-1,2,100); sys_g =frsp
(sys,omega);vplot
('liv,lm',sys_g,'-')
See Also
sel
![]() | madd, msub | mfilter | ![]() |