Mastering Matrix Operations and Linear Equations in MATLAB

Classified in Computers

Written at on English with a size of 3.98 KB.

Matrix Operations and Linear Equations in MATLAB

Format short, long format, format rat (format is the x / y), format short (as is 3 * 10-5 = 3e-5). A = [; ;]. To extract a positive one: A(2,2). Changing a number in one position: A(row, column) = number in that position.

Write a whole line: A(row,:). or A(row, 2:4) - the columns you want from that row. For columns it is the same but in reverse: A(:, 3:7). Extract a submatrix A(2:3, 2:3) - ever-growing range. Transpose: A.'. Conjugate matrix (star A*): A'. Matrix for blocks: [A | E] - like n-th row or [A; E] - so I place it under.

Matrix by number unit: 23 * ones(3). Identity: eye(x, y).

Systems of Linear Equations Ax = b:

  • Rank(A) = rank(A | b) = No incog. - SCD: x = A \ b
  • Rank(A) = rank(A | b) <> No incog. - SCI:
  1. Solution of the homogeneous system: null(A, 'r').
  2. Particular solution: x0 = A \ b.

Fatc. LU = A: Elementary operations in A to make zeros below the main diagonal = U. L = A * inv(U). Calculated under an array: for k = 1:4, det(A(1:k, 1:k)), end. Reduced row echelon form: rref(A).

Elementary Row Operations:

  • Row addition: A(row,:) = A(row,:) + number * A(other_row,:) - a row such that adding to them the row.
  • Row change: Save a row in a variable f: v = A(f,:) and then match it to the row F with which you want to change: A(f,:) = A(F,:). Finally: A(F,:) = v

Lab 6: M(w)c = 1 / 2 * (A + A'), principal minors: for k = 1:n, det(M(1:k, 1:k)), end

Iterative Methods:

Ax = b, x = (A \ b). xk / k € N is a sequence lim xk = x € complex Cn:

  • Classics: A = M - N ---> Mx - Nx = b -> Mx = Nx + b
  • (xk)k: Xor any or xk+1 = M \ (N * x + b)

If we have A, we do: A = D [i.e., diag(diag(A))] + L [i.e., tril(A, -1)] + U [i.e., triu(A, 1)].

Methods:

  • Jacobi: M = D, N = M - A.
  • Gauss-Seidel: M = D + L, N = M - A.
  • With relaxation parameter w <> 0: M = D / w + L.

Calculation of x: for k = 1:50; x = M \ (N * x + b); end. Finally, do two of the standard results: norm(A * x - b).

Practice 5:

s = (v1, v2, v3, v4)

  • If A = (v1 | v2 | v3 | v4) -> rank(A) = 4 -> s is free.
  • v = (1, 3, -7, ...), v € <S> <-> A * (j, k, ...)' = v -> A \ v = (j, k, ...)'

f: R4B -> R4B' linear application. B = (v1, v2, v3, v4), f(vi) = (..)B'

Associated matrix A = BB'.

a) rank(f) = dim[Im(f)] = rank(A)

Base image(f) = {f(v1), ...} generators of image f -> rref(A) (we only take the non-zero vectors; they form the base).

Basis ker(f) = null(A, 'r') -> base (V column) dim ker f + dim Im g = dim R

Base F:

  1. We find the generators of u: (x, y, z, t / (D) * (x, y, ...)' = 0) -> null(D, 'r') = (r1 | ... | rn) = B
  2. Find f(v): A * B = (f(v1) | ... | f(vn)) = U
  3. Find the 3rd base: rref(U)

Entradas relacionadas: