clear all L = 0.2; t = 0:0.01:1; %----- 1a Opção ----- % for i=1:length(t), % % th1(i) = sin(2*pi*t(i)); % th2(i) = cos(2*pi*t(i)); % % x2(i) = L*cos(th1(i)) + L*cos(th2(i)); % y2(i) = L*sin(th1(i)) + L*sin(th2(i)); % % end %----- 2a Opção ----- th1 = sin(4*pi*t); th2 = cos(3*pi*t); xB = L*cos(th1); yB = L*sin(th1); x2 = L*cos(th1) + L*cos(th2); y2 = L*sin(th1) + L*sin(th2); for i=1:length(t) plot([0 xB(i)],[0 yB(i)],'b-','linewidth',3) hold on plot([xB(i) x2(i)],[yB(i) y2(i)],'r-','linewidth',3) plot(x2(1:i),y2(1:i),'k.') plot(xB(i),yB(i),'ko','markerfacecolor','w','markersize',6) plot(0,-0.015,'k^','markerfacecolor','k','markersize',10) plot(0,0,'ko','markerfacecolor','w','markersize',6) hold off legend('X_2','Y_2','location','southwest') xlabel('Tempo (s)') ylabel('Deslocamento (m)') grid on axis([-0.1 0.7 -0.4 0.4]) pause(0.001) end