From: Els on
I have possibly a very simple question.

I have a vector a(x,y,z)(between P and P1), and a vector b(x1,y1,z1)(between P1 and P2).

How do I check in Matlab that the two vectors are in line with each other? So that the angle between the vectors is zero.
From: Yi Cao on
"Els " <y.e.t.reeuwijk(a)student.utwente.nl> wrote in message <ht5ck9$4up$1(a)fred.mathworks.com>...
> I have possibly a very simple question.
>
> I have a vector a(x,y,z)(between P and P1), and a vector b(x1,y1,z1)(between P1 and P2).
>
> How do I check in Matlab that the two vectors are in line with each other? So that the angle between the vectors is zero.

You can check the difference between a'*b and norm(a)*norm(b), whether it is zero.

HTH
Yi
From: Els on
a and b are both row vectors, so

A=a'*b
B=norm(a)*norm(b)

gives me a problem, because A is a 3x3 matrix.
Is it correct to say that A=a*b'?

And that the difference G = round(abs(A-B))?
From: Hiram K. Hackenbacker on
"Els " <y.e.t.reeuwijk(a)student.utwente.nl> wrote in
news:ht5ck9$4up$1(a)fred.mathworks.com:

> I have possibly a very simple question.
>
> I have a vector a(x,y,z)(between P and P1), and a vector
> b(x1,y1,z1)(between P1 and P2).
>
> How do I check in Matlab that the two vectors are in line with each
> other? So that the angle between the vectors is zero.

Check the vector cross product = [0 0 0]
C = cross(A,B); A, B Vectors
From: Yi Cao on
"Els " <y.e.t.reeuwijk(a)student.utwente.nl> wrote in message <ht5gvb$l08$1(a)fred.mathworks.com>...
> a and b are both row vectors, so
>
> A=a'*b
> B=norm(a)*norm(b)
>
> gives me a problem, because A is a 3x3 matrix.
> Is it correct to say that A=a*b'?
>
> And that the difference G = round(abs(A-B))?

That is right.

Yi