Mu Analysis and Synthesis Toolbox | ![]() ![]() |
Add and subtract CONSTANT, SYSTEM, and VARYING matrices
Syntax
Description
madd
(msub
) allows the addition or subtraction of matrices, regardless of their type, as long as their dimensions are compatible. CONSTANT, SYSTEM, and VARYING matrices can be added to or subtracted from one another based on the following table:
|
mat2 |
CONSTANT |
SYSTEM |
VARYING |
|
||||
CONSTANT |
yes |
yes |
yes |
|
SYSTEM |
yes |
yes |
no |
|
VARYING |
yes |
no |
yes |
For compatibility, the number of rows and columns of mat1
must equal the number of rows and columns of mat2
. In the case of SYSTEM matrices, the number of inputs and outputs of mat1
must equal the number of inputs and outputs of mat2
. The same is true for VARYING matrices and in addition, the independent variables of the VARYING matrices must be identical. Up to nine matrices of compatible dimension can be added or subtracted by including them as input arguments.
Pictorial Representationof Functions
Examples
Create two SYSTEM matrices p
and p1
and a CONSTANT matrix.
a = -10;b = 3;c = 10;d = 0; p =pck
(a,b,c,d);minfo
(p) system: 1 states 1 outputs1 inputs a1 = -2; b1 = 3; c1 = 1; d1 = .1;p1
=pck
(a1,b1,c1,d1);minfo
(p1
)seesys
(p,'3.2g') -10 | 3 -----|---- 10 | 0seesys
(p1
,'3.2g') -2 | 3 ----|---- 1 | .1
p
and p1
.
out
=madd
(p,p1
);seesys
(out
,'3.2g') -10 0 | 3 0 -2 | 3 ---------|------ 10 1 | .1minfo
(out
) system: 2 states1 outputs1 inputs
Algorithm
madd
and msub
call the MATLAB + and - commands consistent with the type of matrices.
![]() | indvcmp | massign | ![]() |