Skip to main content
Background Image

[Linear Algebra] Matlab Problem Solving

·272 words·2 mins
Author
Frederic Liu
BS.c. Maths and Stats in OR

Basic procedure
#

Define variables - What to solve for $\downarrow$ A system of equations - Write the equation that describe the problem $\downarrow$ Convert a matrix - Express your system of equations as an Augmented matrix M $\downarrow$ Solve - In matlab, insert the matrix as rref(M) and boom you almost have the answer - you do the rest clean work by your hands and leave the dirty work to matlab $\downarrow$ Interpret - Have the results, then interpret the answers in terms of the question

Curve fitting
#

  • Write the x-axis values in a row vector with a ' to convert to column vectors, then use .^ to raise powers on each of their elements.
  • Then, horizontally contatenate them together with a column vector full of ones (ones(dim, 1)) representing the constant term
  • Then add the y-axis value to the right and form a augmented matrix - then boom, you get what you want

Projection
#

Easy calculation
#

Calculate as the formula, here v projects onto u

$$ \text{proj}_uv = \frac{u\cdot v}{u\cdot u}u $$

Perpendicular vector
#

Line If were to calculate a perpendicular vector to a line, we calculate like this

$$ \text{t}=v-\text{proj}_uv $$

Plane If were to calculate for a plane, we calculate two perpendicular vectors and add them up

Cartesian representation
#

  • We first calculate the normal vector using the approach above
  • Then we substitute in a vector and get the d in ax + by + cz = d

Calculate intersection of planes
#

  • We first list the Cartesian forms together
  • Then we do RREF on the system of equations, and see what we have left