I am trying to recreate this engine in Matlab: http://www.animatedengines.com/co2.html. I am looking to use handle graphics in order to animate all of the moving parts. I have
Here's an example for a small circle moving around a larger circle:
%# create large-circle coordinates
t = 0:pi/100:2*pi;
xc = cos(t);
yc = sin(t);
%# create small-circle coordinates
xs = 0.1*cos(t);
ys = 0.1*sin(t);
%# plot large circle
figure,plot(xc,yc,'r');
%# plot small circle at first position
%# and capture handle
smallCircleH = plot(xs+xc(1),ys+yc(1),'b');
%# loop to update the handle of the small circle
for tIdx = 1:length(t)
%# update position of small circle
set(smallCircleH,'xData',xs+xc(tIdx),'yData',ys+yc(tIdx));
%# wait a bit to appreciate the beauty
pause(0.1);
end