From: Uwe Ligges (email@example.com)
Date: Sat 29 May 2004 - 07:35:27 EST
Uwe Ligges wrote:
> firstname.lastname@example.org wrote:
>> Hi All,
>> (I have a degree in math, but I am too embarassed to ask my
>> colleagues, so here goes:)
>> I would like to get a vector normal (orthogonal) to a plane formed by
>> two other vectors. In matlab I do this:
>> v1 = [.4, .6, .8]; v2 = [.9, .7, .2]; nn = cross(v1,v2) (gives ~[-.48,
>> .65, -.24]
> I don't have access to Matlab. Can you tell me how cross() is defined in
> Matlab (it's not obvious to me - at least not at 10:40 pm - how can
> anything get negative)?
My apologies - and thanks to Rolf Turner who told me the truth (well, I
anticipated that it's getting too late this friday evening).
OK, I don't think what you are looking for is defined as a function in
R. Anyway, for the 3D case it's pretty easy to write the result in one
line of code ...
>> if I do R> cross(v1, v2), I get .94. Huh?
> Ha! ;-)
> crossprod(v1, v2):
> 0.4*0.9 + 0.6*0.7 + 0.8*0.2 = 0.94
> Uwe Ligges
>> Thanks for all your help, again.
>> Remail@example.com mailing list
>> PLEASE do read the posting guide!
> Rfirstname.lastname@example.org mailing list
> PLEASE do read the posting guide!
Remail@example.com mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:13 EST