generate a matrix along the length of an inclined line
1 view (last 30 days)
Show older comments
Ace_ventura
on 13 Feb 2015
Commented: Ace_ventura
on 13 Feb 2015
I have an inclined line of a given length 'L' in XY coordinate plane, at a certain angle alpha with global X axis.My input would be a certain length say 's' and I want to generate a matrix which contains X and Y coordinates along the line at a distance 's' that I have inputted. So, basically the coordinates are at a spacing of 's' along the line of length 'L'. How can i get that matrix?
0 Comments
Accepted Answer
Michael Haderlein
on 13 Feb 2015
Edited: Michael Haderlein
on 13 Feb 2015
I hope I got your question right. I suppose you have a line originating at (x0/y0) with an angle alpha and a length L:
L=5;alpha=pi/6;
x0=2;y0=1;
figure, hold all
plot([x0 x0+L*cos(alpha)],[y0 y0+L*sin(alpha)])
axis equal
Secondly, you have a distance s smaller than L and you want all steps of size s on that original line, right?
s=.5;
xs=x0+(0:s:L)*cos(alpha);
ys=y0+(0:s:L)*sin(alpha);
plot(xs,ys,'o')
If you don't want (x0/y0) to be part of (xs/ys), just increment starting from s instead of starting from 0.
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!