How do I plot a line of a fixed length and slope?
2 次查看(过去 30 天)
显示 更早的评论
I need to plot a line that has some fixed slope at some point, and the length is given, too. How should I do this? Thanks in advance!
0 个评论
回答(2 个)
Walter Roberson
2015-11-30
For a line y = m * x + b, to reach a length of L relative to y = b at x=0, the upper range of x should be L/sqrt(m^2+1)
0 个评论
Thorsten
2015-11-30
slope = 120/180*pi; length = 10; dx = 10; dy = -20;
line([-length/2*cos(slope) length/2*cos(slope)]+dx, [-length/2*sin(slope) length/2*sin(slope)]+dy)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!