tags:

views:

197

answers:

3

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.

+4  A: 

there is a function for plotting in polar coordinates. try

>> polar( (0:180)/180*pi, distanceVector)
second
+1  A: 
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.

KennyTM
Thanks for your attention.But what I need might be a trigonometric function in an loop to seek for angles and put dots to proper places on the plot.I mean,I should construct this map continuously.Here is the story. The robot laser sensor reads the distances as 181x1 distance vector.And this vector contains data like this [11.2 11.3 11.4 17 17.1 17.2 .....].Here the first value 11.2 corresponds to the first concrete object that laser sensor read from 0°.This is same for all 181 values(0 to 180).So I need to construct a map by putting these dot onto a plot or something like it.
dopache
@dopache: I don't understand. What's wrong with `plot()`?
KennyTM
+2  A: 

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,'.')
yuk

related questions