Linear Equations -- JHU MATLAB Help Page
LINEAR EQUATIONS
Creating a Matrix
Substituting Within a Symbolic Matrix
Manipulating Regular Matrices
Vectors
Scalar Multiplication
Addition of Matrices
Gauss-Jordan Elimination
Reduced Row-Echelon Form
Dot Product
Rank
Number of Solutions
Substituting Within a Symbolic Matrix
How to
Examples
Exercise
How to:
If you need to change the symbols within a symbolic matrix:
A = subs(A, 'symbol to be substituted', value it will be substituted with)
(note: here, the first argument of the subs operation 'A' is the name of the matrix we are using, it will not always necessarily be 'A')
Or, if you needed to change multiple symbols at the same time:
A = subs(A, {'1st symbol', '2nd', 'etc.'}, {1st value, 2nd, etc.})
Examples:
Say you had the symbolic matrix, S, as before, 'a, b, c, d' in the first row and 'e, f, g, h' in the second row. Through your computations you discover a=5, and you'd like to represent that within your matrix without typing the whole thing:
P = subs(P, 'a', 5)
Through some more computation, you find out that 'c', 'd', and 'e' are all equal to 7:
P = subs(P, {'c', 'd', 'e'}, {7, 7, 7})
Exercise:
Given a matrix
A = sym('[a, b; c, d; b, a; d, a]')
, replace
a
with 10,
b
with 6,
c
with -3, and
d
with 11.
Click here to see the answer.