% Copyright 2007 - Neil Desmond % Matlab code for plotting length and width factor per leg pivot angle % March 25, 2007 clear all close all % for length: r1 = (1-2*atan(1/9)/pi)/2; %a1 = 0:0.01:pi*r1; a1 = 0:0.01:pi/2; b1 = sqrt(41/2)*(sin((pi*r1)-a1)); figure(1) hold on axis([0 90 0 5]) title('Length Factor per Leg Pivot Angle') xlabel('Leg Pivot Angle (degrees)') ylabel('Length Factor') grid plot(180*a1/pi,b1) text(43.5,-0.12,'45') set(gcf,'DefaultTextColor','green') text(52,b1(uint8(100*pi/4)+1),num2str(b1(uint8(100*pi/4)+1),3)) set(gcf,'DefaultTextColor','red') text(63,b1(uint8(100*pi/3)+1),num2str(b1(uint8(100*pi/3)+1),3)) set(gcf,'DefaultTextColor','blue') text(90-180*atan(1/9)/pi-2,-0.12,num2str(90-180*atan(1/9)/pi,4)) plot(0,b1(uint8(100*pi/4)+1),'gx') plot((2:43),b1(uint8(100*pi/4)+1).*ones(1,42),'g') plot(0,b1(uint8(100*pi/3)+1),'rx') plot((2:58),b1(uint8(100*pi/3)+1).*ones(1,57),'r') stem(45,b1(uint8(100*pi/4)+1),'g.--') stem(60,b1(uint8(100*pi/3)+1),'r.--') % for width: r2 = (1-2*atan(1/7)/pi)/2; %a2 = 0:0.01:pi*r2; a2 = 0:0.01:pi/2; b2 = 5*sqrt(2)*(sin((pi*r2)-a2))/2; figure(2) hold on axis([0 90 0 5]) title('Width Factor per Leg Pivot Angle') xlabel('Leg Pivot Angle (degrees)') ylabel('Width Factor') grid plot(180*a2/pi,b2) text(43.5,-0.12,'45') set(gcf,'DefaultTextColor','green') text(52,b2(uint8(100*pi/4)+1),num2str(b2(uint8(100*pi/4)+1),3)) set(gcf,'DefaultTextColor','red') text(63,b2(uint8(100*pi/3)+1),num2str(b2(uint8(100*pi/3)+1),3)) set(gcf,'DefaultTextColor','blue') text(90-180*atan(1/7)/pi,-0.12,num2str(90-180*atan(1/7)/pi,4)) plot(0,b2(uint8(100*pi/4)+1),'gx') plot((2:43),b2(uint8(100*pi/4)+1).*ones(1,42),'g') plot(0,b2(uint8(100*pi/3)+1),'rx') plot((2:58),b2(uint8(100*pi/3)+1).*ones(1,57),'r') stem(45,b2(uint8(100*pi/4)+1),'g.--') stem(60,b2(uint8(100*pi/3)+1),'r.--')