Week 2- 2R Robotic Arm Challenge

The following is the program to simulate the forward kinematics of a 2R Robotic Arm
clear variables
close all
clc
%Imputs
%Length in meters
l1=2; %Length of Link1
l2=1; %Length of Link2
theta1=linspace(0,90,10); %Angular movement of Link1 in 2D plane
theta2=linspace(0,90,10); %Angular movement of Link2 in 2D plane
ct=1;
for i=1:length(theta1)
THETA1=theta1(i)
for j=1:length(theta2)
THETA2=theta2(j)
%Starting point of the Robotic Arm
x0=0;
y0=0;
%Calculation of Link1 position
x1=l1*cosd(THETA1);
y1=l1*sind(THETA1);
%Calculation of Link2 position
x2=x1+l2*cosd(THETA2);
y2=y1+l2*sind(THETA2);
%Plotting
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',2.5)
axis([-1 3 0 3])
pause(0.05)
M(ct)= getframe(gcf);
ct=ct+1;
end
end
movie(M)
videofile = VideoWriter('Robotic_Arm_Movement.avi','Uncompressed AVI')
open(videofile)
writeVideo(videofile,M)
close(videofile)
Following assumption are made
Length(l1) of Link1 is 2meters & Length(l2) of Link2 is 1meter
The movement of Robotic arm is restricted to 2D plane first quadrant(ie angular movement of link is limited from 0 degrees to 90 degrees)
For loop has been used to evaluate the position of the Link1 with respect to origin and position of Link2 with respect to endpoint of the Link1. For loop is also used for plotting the different orientation of the Link1 and Link2 and also to capture the frame of plot in the varaiable 'M' for different orientation or position.
Once different frames are captured, a small animation has been generated using movie(variable) command. After that videofile has been generated in specific video format using VideoWriter('Name of the videofile', 'Video format')
Finally the video has been saved at the location where the program file with .m extension has been saved.
The following error has been encountere while running the program

After understanding the error, it has been resolved using the lower case letter 'm' for movie

The same error was encountered with Videowriter command. it also had the same issue of lower case letter 'w' was used instead of Upper case letter 'W'.
After successfully running the following video has been generated, which has been uploaded on the youtube with following link to access.
The video has been uploaded on the google drive and it's link has been shared below.
https://drive.google.com/file/d/1hYXDKhALCYygOhlI46WtTDb8JUDE7avx/view?usp=sharing