
%load cpath,ext
[garbage,size] = size(cpath);

x = zeros(1,size/2);
y = zeros(1,size/2);

angle = 90;
vel = 0;

if cpath(2)==0
	cpath (2)= 5;
end


for i=2:(size/2)

	a = cpath(2*i);	

	switch a
		case 1, turn = 5;
		case 2, turn = 4.5;
		case 3, turn = 3;
		case 4, turn = 1.5;
		case 5, turn = 0;
		case 6, turn =  -1.5;
		case 7, turn =  -3;
		case 8, turn =  -4.5;
		case 9, turn =  -5;
		otherwise, turn = turn;
	end

	speed = cpath((2*i)-1);

	if speed == 0
		vel = 0;
		
	else
      vel = speed/5;
      angle = angle + turn;
	end

	
      
	x(i) = x(i-1) + vel*sin(angle*pi/180);
	y(i) = y(i-1) + vel*cos(angle*pi/180);
end

plot(y,x,'-')
hold on
plot(y,x,'o')
hold off
axis equal;         
         
      
      
