image thumbnail
from 4RRR Kinematics with GUI and Mouse Support by Hrishi Shah
Fully Generalized 4RRR Kinematics with GUI

[xy3 serplot]=serialplotinit(j_vars, base, lengths, i, serplot)
function [xy3 serplot]=serialplotinit(j_vars, base, lengths, i, serplot)
th1=j_vars(1,1);
th2=j_vars(1,2);
th3=j_vars(1,3);
l1=lengths(1);
l2=lengths(2);
l3=lengths(3);
x(1)=base(1);
y(1)=base(2);
x(2)=x(1)+l1*cos(th1);
y(2)=y(1)+l1*sin(th1);
x(3)=x(2)+l2*cos(th1+th2);
y(3)=y(2)+l2*sin(th1+th2);
x(4)=x(3)+l3*cos(th3);
y(4)=y(3)+l3*sin(th3);
xy3=[x(3) y(3)];
if i==1
    serplot(1)=plot(x,y,'color','r');
elseif i==2
    serplot(2)=plot(x,y,'color','g');
elseif i==3
    serplot(3)=plot(x,y,'color','b');
else
    serplot(4)=plot(x,y,'color','k');
end
return

Contact us at files@mathworks.com