Wednesday, March 23, 2011

Exercise 7, Problem 2

Make a function polar2carth(pol) that converts the polar coordinates in pol (same format as the Problem 1) to Cartesian coordinates x,y.

polar2carth.m
function carthScan = polar2carth (polarScan)
carthScan(1,:) = polarScan(2,:).*cos(polarScan(1,:));
carthScan(2,:) = polarScan(2,:).*sin(polarScan(1,:));

exercise7.m
carthScan = polar2carth(laserScan);
figure(2);
plot(carthScan(1,:),carthScan(2,:),'.')
title('Ex 7, Problem 2')

No comments:

Post a Comment