Challenge

Week 2- 2R Robotic Arm Challenge

the link 1 and 2 are described with the numbers,

and the theta 1 &2 are mentioned with the linspace command as it will give 5 values between the numbers given as mentioned is 5,

the ct remains for the figure and the for loop is executed below,

the cosd and sind where d remains for the degree,

then the plot and movie creating command has been executed.

the movie youtube link has been given

https://youtu.be/mqhQM2ZoM24

link1 = 1.5
link2 = 1
theta1 = linspace(0,90,5);
theta2 = linspace(0,90,5);
ct = 1;
for a = 1:length(theta1)
    THETA1 = theta1(a);
    for b = 1:length(theta2)
        THETA2 = theta2(b);
        x0 = 0;
        y0 = 0;
        x1 = link1*cosd(THETA1);
        y1 = link1*sind(THETA2);
        x2 = x1+link2*cosd(THETA2);
        y2 = y1+link2*sind(THETA2);
        plot([x0 x1],[y0 y1],[x1 x2],[y1 y2], 'LineWidth',3);
        axis([-0.1 1.5 0 1.5]);
        pause(1);
        M(ct) = getframe(gcf);
        ct = ct+1;

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

the error files are listed below,

the videowriter error has been shown beacuse of not use the capital and has been corrected with "VideoWriter"

the writevideo error has been shown beacuse of not use the capital and has been corrected with "WriteVideo"

as i mentioned AVI format to MP4, it doesnot specified and the file again changed to AVI format

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.

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.