use matlab to find the coordinates of the vector (-3,1) in the basis given by (-1,0),(1,1) in matlab

To find the coordinates of the vector (-3,1) in the basis given by (-1,0) and (1,1), we first need to create a matrix with the basis vectors as columns. We can then solve the system of equations Ax = b, where A is the matrix of basis vectors, x is the vector of coordinates we are trying to find, and b is the vector we want to express in terms of the basis vectors.

Here's how to do it in MATLAB:

main.m
% Define the basis vectors and the vector we want to find the coordinates of
a = [-1 1]';  % first basis vector
b = [0 1]';   % second basis vector
v = [-3 1]';  % vector we want to find the coordinates of

% Create the matrix A by concatenating the basis vectors
A = [a b];

% Solve the system of equations Ax = v to find the coordinates of v in the basis of A
x = A \ v;
373 chars
11 lines

The result is a column vector x that contains the coordinates of v in the basis of A:

main.m
x =

   2
   1
15 chars
5 lines

Therefore, the coordinates of the vector (-3,1) in the basis given by (-1,0) and (1,1) are (2,1).

gistlibby LogSnag