Reputation: 1497
I am trying to create a 2D map of some place. I get a 181x1 vector of laser sensor readings from a robot. All the values in this vector corresponds to a distance from that single angle like 1°,2°..180°. The problem here is I need to create a map by plotting these distances as dots with plot() or a similar function to it.
Upvotes: 0
Views: 2570
Reputation: 19870
You can convert your angle-distance coordinates to Cartesian X and Y with POL2CART function.
[X,Y] = pol2cart((1:180)/180*pi, distanceVector);
Then you can use PLOT.
plot(X,Y,'.')
Upvotes: 2
Reputation: 523304
plot(theVector, '.')
if you need to plot as dots instead of lines. If the dot is too small, try to plot as circles.
plot(theVector, 'o')
See http://www.mathworks.com/access/helpdesk/help/techdoc/ref/linespec.html for detail.
Upvotes: 1
Reputation: 28637
there is a function for plotting in polar coordinates. try
>> polar( (0:180)/180*pi, distanceVector)
Upvotes: 4