It seems like this should be easy, but I'm no expert and google isn't helping.
I would like an elegant way in Matlab of producing the standard ordered basis vectors for an n-dimensional space. For example, behaviour similar to the following:
>> [e1, e2] = SOB(2);
>> e1
e1 = 1 0
>> e2
e2 = 0 1
I'm hoping for a 1-liner and don't really want to write a function for something so simple.
Thanks
There are several common notations for standard-basis vectors, including {ex, ey, ez}, {e1, e2, e3}, {i, j, k}, and {x, y, z}. These vectors are sometimes written with a hat to emphasize their status as unit vectors (standard unit vectors).
Q = orth( A ) returns an orthonormal basis for the range of A . The columns of matrix Q are vectors that span the range of A . The number of columns in Q is equal to the rank of A . Q = orth( A , tol ) also specifies a tolerance.
Theorem Suppose L : Rn → Rm is a linear map. Then there exists an m×n matrix A such that L(x) = Ax for all x ∈ Rn. Columns of A are vectors L(e1),L(e2),...,L(en), where e1,e2,...,en is the standard basis for Rn.
Why not
A = eye(N);
then A(:,i)
is your i-th basis vector
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With