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 u
and v
whose dot product is u.v=0
(i.e., the vectors are perpendicular) are said to be orthogonal.
v_new
is not orthogonal to the rows ofA
. Do you meanv_new=[0 0 0 0 1]
? – AVK