How to generate a vector that orthogonal to other vectors?

Jame

I have a matrix A which is

A=[1 0 0 1 0; 
   0 1 1 0 0; 
   0 0 1 1 0; 
   1 1 1 0 0]

And a given vector v=[ 0 0 1 1 0] which has two elements one. I have to change the position of element one such that the new vector v is orthogonal to all the rows in the matrix A. How can I do it in Matlab?

To verify the correct answer, just check gfrank([A;v_new]) is 5 (i.e v_new=[0 1 0 0 1]).

Note that: Two vectors uand v whose dot product is u.v=0 (i.e., the vectors are perpendicular) are said to be orthogonal.

Sardar Usama

As AVK also mentioned in the comments, v_new = [0 1 0 0 1] is not orthogonal to all rows of A.

Explanation:-

A=[1 0 0 1 0; 
   0 1 1 0 0; 
   0 0 1 1 0; 
   1 1 1 0 0]

For A(1,:).*v = 0 to A(4,:).*v = 0,

0 x x 0 x        % elements of v so that it's orthagonal to the 1st row of A
x 0 0 x x        % -------------------------------------------- 2nd row of A
x x 0 0 x        % -------------------------------------------- 3rd row of A
0 0 0 x x        % -------------------------------------------- 4th row of A

where 0 represents the terms which have to be 0 and x represents the terms which can be either 0 or 1.

If you look as a whole, first 4 columns of v have to be zero so that the output is orthagonal to all rows of A. The 5th column can either be zero or 1.

So, v_new can either be: v_new = [0 0 0 0 1] or v_new = [0 0 0 0 0]

From above explanation, you can also see that [0 1 0 0 1] is not orthagonal to 2nd and 4th row of A


Solution:-

To find v_new, you can use null function as: v_new = null(A).'
which gives: v_new = [0 0 0 0 1] for which gfrank([A;v_new]) also gives 5.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

A vector as a patchwork of two other vectors

From Dev

sizeof for vector<bool> and for other vectors

From Dev

generating two orthogonal vectors that are orthogonal to a particular direction

From Dev

Compare value in vector with all other vectors

From Dev

How to generate these vectors quickly in Python?

From Dev

How to group a vector into a list of vectors?

From Dev

How to initialize a vector of vectors on a struct?

From Dev

How to iterate over Vector of Vectors

From Dev

How to convert a Matrix into a Vector of Vectors?

From Dev

How to group a vector into a list of vectors?

From Dev

How to iterate through a vector of vectors?

From Dev

How do you calculate new vector based on the other two vectors starting at origin?

From Dev

I want to generate new vectors from another vector

From Dev

Sum the values in a vector according to the range specified by other vectors

From Dev

How to obtain a vector perpendicular to a set of vectors (with Matlab)?

From Dev

How to append a vector to a list of vectors in R?

From Dev

How to concatenate word vectors to form sentence vector

From Dev

How to keep two vectors of points in One vector

From Dev

How to check if a vector is within two vectors

From Dev

How to take a vector of vectors contents into a single column vector

From Dev

When are hash functions orthogonal to each other?

From Dev

In matlab, generating a matrix by adding the elements of two orthogonal vectors

From Dev

In matlab, generating a matrix by adding the elements of two orthogonal vectors

From Dev

R: How to generate vectors of highest value in each row?

From Dev

How to generate a number of random vectors starting from a given one

From Dev

How to generate a number of random vectors starting from a given one

From Dev

R: How to generate vectors of highest value in each row?

From Dev

How do I generate all the vectors by swapping two positions?

From Dev

How do I generate random vectors from a bar graph of probabilities?

Related Related

  1. 1

    A vector as a patchwork of two other vectors

  2. 2

    sizeof for vector<bool> and for other vectors

  3. 3

    generating two orthogonal vectors that are orthogonal to a particular direction

  4. 4

    Compare value in vector with all other vectors

  5. 5

    How to generate these vectors quickly in Python?

  6. 6

    How to group a vector into a list of vectors?

  7. 7

    How to initialize a vector of vectors on a struct?

  8. 8

    How to iterate over Vector of Vectors

  9. 9

    How to convert a Matrix into a Vector of Vectors?

  10. 10

    How to group a vector into a list of vectors?

  11. 11

    How to iterate through a vector of vectors?

  12. 12

    How do you calculate new vector based on the other two vectors starting at origin?

  13. 13

    I want to generate new vectors from another vector

  14. 14

    Sum the values in a vector according to the range specified by other vectors

  15. 15

    How to obtain a vector perpendicular to a set of vectors (with Matlab)?

  16. 16

    How to append a vector to a list of vectors in R?

  17. 17

    How to concatenate word vectors to form sentence vector

  18. 18

    How to keep two vectors of points in One vector

  19. 19

    How to check if a vector is within two vectors

  20. 20

    How to take a vector of vectors contents into a single column vector

  21. 21

    When are hash functions orthogonal to each other?

  22. 22

    In matlab, generating a matrix by adding the elements of two orthogonal vectors

  23. 23

    In matlab, generating a matrix by adding the elements of two orthogonal vectors

  24. 24

    R: How to generate vectors of highest value in each row?

  25. 25

    How to generate a number of random vectors starting from a given one

  26. 26

    How to generate a number of random vectors starting from a given one

  27. 27

    R: How to generate vectors of highest value in each row?

  28. 28

    How do I generate all the vectors by swapping two positions?

  29. 29

    How do I generate random vectors from a bar graph of probabilities?

HotTag

Archive