Uwe Ligges wrote:
[EMAIL PROTECTED] 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]
Huh?
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 ...
Uwe
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.
W
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html