Project element on a line
1 次查看(过去 30 天)
显示 更早的评论
Hi everyone! My question is: how can i project an element on a straight line? In other words, i have a matrix(nx2) that represent my element and a matrix(2x2) that represent my straight line, how can i project that element on that line? Is there a function? Thx in advance! :)
2 个评论
Matt J
2012-9-29
Explain how an nx2 matrix represent a (single?) element to be projected. Is each row a coordinate in 2D? And if so, how does a 2x2 matrix represents a straight line? In 2D, only 2 parameters are required to represent a line, not a 2x2 matrix.
采纳的回答
Matt J
2012-9-30
编辑:Matt J
2012-9-30
In your example, the line new_w1 is going through the origin. I'll assume that to be the case here.
In general, if you want to project X1 onto the line through the origin t*d where d is the direction vector of the line, you would do
projections = X1*d(:)*d(:).'/norm(d)^2
2 个评论
Matt J
2012-10-1
I'm not aware of the distinction between "orthogonal projection" and "perpendicular projection".
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!