%daspect([1.0 1.0 1.0]) %shows even scaling on axes [t,theta1] = mypend(pi+0.1,pi+0.2,1,1,1,0.005,40,0); figure(2) grid on,hold veh1X = [-0.1 0.1 0.1 -0.1]; veh1Y = [-0.1 -0.1 1 1]; theta1 = theta1-pi; h1 = fill(veh1X,veh1Y,'b'); set(h1,'Erasemode','Background'); axis([-2 2 -2 2]); i=1; set(h1,'Xdata',veh1X*cos(theta1(i))-veh1Y*sin(theta1(i)),... 'Ydata',veh1Y*cos(theta1(i))+veh1X*sin(theta1(i))); drawnow pause for i=2:length(theta1), set(h1,'Xdata',veh1X*cos(theta1(i))-veh1Y*sin(theta1(i)),... 'Ydata',veh1Y*cos(theta1(i))+veh1X*sin(theta1(i))); drawnow end