[Mathematical knowledge] Coordinate base representation of vectors, Matlab code verification

serial number content
1 [Mathematical knowledge] Coordinate base representation of vectors, Matlab code verification
2 [Mathematical knowledge] Inner product of vector and base, Matlab code verification

1. Coordinate base representation of vector

Suppose there is a vector a ⃗ \vec{a} in the spacea , in different coordinate systems (or coordinate bases), vector a ⃗ \vec{a}a Represented by different coordinate values.

When the coordinate base is uniquely determined, the corresponding coordinate values ​​are also uniquely determined. At the same time, vectors can also be represented by a linear combination of coordinate values ​​and coordinate lines.

  • When the vector is a two-dimensional plane vector, it can be expressed as
    a ⃗ = axe ⃗ 1 + aye ⃗ 2 = [ e ⃗ 1 e ⃗ 2 ] [ axay ] \vec{a} = a_x \vec{e}_1 + a_y \vec{e}_2 = \left[\begin{matrix}\vec{e}_1 & \vec{e}_2 \end{matrix}\right] \left[\begin{matrix}a_x \\ a_y \end {matrix}\right]a =axe 1+aye 2=[e 1e 2][axay]

  • When the vector is a vector in a three-dimensional space, it can be expressed as
    a ⃗ = ax ⃗ 1 + aye ⃗ 2 + aze ⃗ 3 = [ e ⃗ 1 e ⃗ 2 e ⃗ 3 ] [ axayaz ] \vec{a} = a_x \vec {e}_1 + a_y \vec{e}_2 + a_z \vec{e}_3 = \left[\begin{matrix}\vec{e}_1 & \vec{e}_2 & \vec{e}_3 \ end{matrix}\right] \left[\begin{matrix}a_x \\ a_y \\ a_z \end{matrix}\right]a =axe 1+aye 2+aze 3=[e 1e 2e 3] axayaz


2. Example of two-dimensional plane vector

The following is an example based on a vector in a two-dimensional plane, but the case in three-dimensional space has the same properties and conclusions.

Suppose there is a two-dimensional plane vector a ⃗ \vec{a} as mentioned abovea , in the standard coordinate base e ⃗ 1 = [ 1 0 ] , e ⃗ 2 = [ 0 1 ] \vec{e}_1=\left[\begin{matrix} 1 \\ 0 \\ \end{matrix}\right ], \vec{e}_2=\left[\begin{matrix} 0 \\ 1 \\ \end{matrix}\right]e 1=[10],e 2=[01] The coordinate value under is[ axay ] = [ 3 4 ] \left[\begin{matrix}a_x \\ a_y \end{matrix}\right] = \left[\begin{matrix}3 \\ 4 \end{ matrix}\right][axay]=[34] . Then this vector can be expressed as

a ⃗ = a x e ⃗ 1 + a y e ⃗ 2 = [ e ⃗ 1 e ⃗ 2 ] [ a x a y ] = 3 [ 1 0 ] + 4 [ 0 1 ] = [ 1 0 0 1 ] [ 3 4 ] = [ 3 4 ] \begin{aligned} \vec{a} &= a_x \vec{e}_1 + a_y \vec{e}_2 = \left[\begin{matrix}\vec{e}_1 & \vec{e}_2 \end{matrix}\right] \left[\begin{matrix}a_x \\ a_y \end{matrix}\right] \\ &= 3 \left[\begin{matrix}1 \\ 0 \end{matrix}\right] + 4 \left[\begin{matrix}0 \\ 1 \end{matrix}\right] = \left[\begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix}\right] \left[\begin{matrix}3 \\ 4 \end{matrix}\right] = \left[\begin{matrix}3 \\ 4 \end{matrix}\right] \end{aligned} a =axe 1+aye 2=[e 1e 2][axay]=3[10]+4[01]=[1001][34]=[34]

Now, we change the coordinate base to e ⃗ 1 ′ = [ 1 2 1 2 ] , e ⃗ 2 ′ = [ − 1 2 1 2 ] \vec{e}_{1^\prime}=\left[\begin{ matrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \\ \end{matrix}\right], \vec{e}_{2^\prime }=\left[\begin{matrix} -\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \\ \end{matrix}\right]e 1=[2 12 1],e 2=[2 12 1] , the coordinate value under this new basis is[ ax ′ ay ′ ] = [ 7 2 1 2 ] \left[\begin{matrix}a_{x^\prime} \\ a_{y^\prime} \end{ matrix}\right] = \left[\begin{matrix} \frac{7}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{matrix}\right][axay]=[2 72 1] . Then this vector can be expressed as

a ⃗ = 7 2 [ 1 2 1 2 ] + 1 2 [ − 1 2 1 2 ] = [ 1 2 − 1 2 1 2 1 2 ] [ 7 2 1 2 ] = [ 3 4 ] \begin{aligned} \vec{a} &= \frac{7}{\sqrt{2}} \left[\begin{matrix}\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{matrix}\right] + \frac{1}{\sqrt{2}} \left[\begin{matrix}-\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{matrix}\right] = \left[\begin{matrix} \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \end{matrix}\right] \left[\begin{matrix} \frac{7}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{matrix}\right] = \left[\begin{matrix}3 \\ 4 \end{matrix}\right] \end{aligned} a =2 7[2 12 1]+2 1[2 12 1]=[2 12 12 12 1][2 72 1]=[34]

From the above example, we can see that no matter which coordinate base is used, there will always be the following equation

a ⃗ = a x e ⃗ 1 + a y e ⃗ 2 = [ e ⃗ 1 e ⃗ 2 ] [ a x a y ] = a x ′ e ⃗ 1 ′ + a y ′ e ⃗ 2 ′ = [ e ⃗ 1 ′ e ⃗ 2 ′ ] [ a x ′ a y ′ ] \begin{aligned} \vec{a} &= a_x \vec{e}_1 + a_y \vec{e}_2 = \left[\begin{matrix}\vec{e}_1 & \vec{e}_2 \end{matrix}\right] \left[\begin{matrix}a_x \\ a_y \end{matrix}\right] \\ &= a_{x^\prime} \vec{e}_{1^\prime} + a_{y^\prime} \vec{e}_{2^\prime} = \left[\begin{matrix}\vec{e}_{1^\prime} & \vec{e}_{2^\prime} \end{matrix}\right] \left[\begin{matrix}a_{x^\prime} \\ a_{y^\prime} \end{matrix}\right] \end{aligned} a =axe 1+aye 2=[e 1e 2][axay]=axe 1+aye 2=[e 1e 2][axay]

Similar conclusions can be drawn for vectors in three-dimensional space.


As for how to obtain the coordinate values ​​​​under the new basis, we can achieve it through the following steps

[ e ⃗ 1 e ⃗ 2 ] [ a x a y ] = [ e ⃗ 1 ′ e ⃗ 2 ′ ] [ a x ′ a y ′ ] [ e ⃗ 1 ′ e ⃗ 2 ′ ] − 1 [ e ⃗ 1 e ⃗ 2 ] [ a x a y ] = [ a x ′ a y ′ ] [ 1 2 − 1 2 1 2 1 2 ] − 1 [ 1 0 0 1 ] [ 3 4 ] = [ 7 2 1 2 ] \begin{aligned} \left[\begin{matrix}\vec{e}_1 & \vec{e}_2 \end{matrix}\right] \left[\begin{matrix}a_x \\ a_y \end{matrix}\right] &= \left[\begin{matrix}\vec{e}_{1^\prime} & \vec{e}_{2^\prime} \end{matrix}\right] \left[\begin{matrix}a_{x^\prime} \\ a_{y^\prime} \end{matrix}\right] \\ \left[\begin{matrix}\vec{e}_{1^\prime} & \vec{e}_{2^\prime} \end{matrix}\right]^{-1} \left[\begin{matrix}\vec{e}_1 & \vec{e}_2 \end{matrix}\right] \left[\begin{matrix}a_x \\ a_y \end{matrix}\right] &= \left[\begin{matrix}a_{x^\prime} \\ a_{y^\prime} \end{matrix}\right] \\ \left[\begin{matrix} \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \end{matrix}\right]^{-1} \left[\begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix}\right] \left[\begin{matrix} 3 \\ 4 \end{matrix}\right] &= \left[\begin{matrix} \frac{7}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{matrix}\right] \\ \end{aligned} [e 1e 2][axay][e 1e 2]1[e 1e 2][axay][2 12 12 12 1]1[1001][34]=[e 1e 2][axay]=[axay]=[2 72 1]

Please add image description


3. Matlab code verification

a_x = 3;
a_y = 4;

e_1 = [ 1
        0];
e_2 = [ 0
        1];

a_x_prime = 7/sqrt(2);
a_y_prime = 1/sqrt(2);

e_1_prime = [ sqrt(2)/2
              sqrt(2)/2];
e_2_prime = [-sqrt(2)/2
              sqrt(2)/2];
>> pinv([e_1_prime  e_2_prime]) * [e_1  e_2] * [a_x; a_y]
ans =
    4.9497
    0.7071

>> a_x_prime
ans =
    4.9497

>> a_y_prime
ans =
    0.7071

Ref


Guess you like

Origin blog.csdn.net/weixin_36815313/article/details/132310268