Challenge

Week 3.2 - 2R Robotic Arm Challenge

clear all
close all
clc
% lenght of two link
link_1 = 2;
link_2 = 1.5;
ct = 1;
% angle of link_1 and link_2
angle_1 = linspace(0,90,10);
angle_2 = linspace(0,90,10);
for i = 1:length(angle_1);
    theta_1 = angle_1(i);
    for j = 1: length(angle_2);
        theta_2 = angle_2(j);
        %(x0,y0) cordinate points
        x0 = 0;
        y0 = 0;
        %(x1,y1) cordinate points
        x1 = link_1*cosd(theta_1);
        y1 = link_1*sind(theta_1);
        %(x2,y2) cordinate points
        x2 = x1 + link_2*cosd(theta_2);
        y2 = y1 + link_2*sind(theta_2);
        %graph plotting
        plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3);
        axis([-0.1 4.5 0 4.5])
        pause(0.03)
        M(ct) = getframe(gcf);
        ct=ct+1;

    end
end
movie(M)
videofile = VideoWriter('kinematics.avi','Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)

output:

attaching errors in ppt attached

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.