Week 3 - Solving second order ODEs
clear all
close all
clc
% inputs for variables
l=1;
m=1;
b=0.05;
g=9.81;
% initial conditions
theta_0=[0;5];
t_span=linspace(0,5,50);
[t,results]=ode45(@(t,theta)ode_function(theta,b,g,l,m),t_span,theta_0);
figure(1)
plot(t,results(:,1))
hold on
plot(t,results(:,2))
ylabel('plot')
xlabel('time')
%counter variable
ct=1;
%simulation of simple pendulum
for i=1:length(t)
x=l*sin(results(i,1));
y=-l*cos(results(i,1));
figure(2)
plot([-0.5 0.5],[0 0],'linewidth',1,'color','k')
hold on
plot(x ,y,'marker','o','markersize',8)
plot([0 x],[0 y],'linewidth',1,'color','b')
plot(0,0,'-o','markerfacecolor','k','markersize',8)
xlabel('xaxis')
ylabel('yaxis')
axis([-2 2 -2 2])
% pause(0.03)
M(ct)=getframe(gcf)
ct=ct+1
hold off
end
% movie(M)
videofile=VideoWriter('simulation of simple pendulum.avi')
open(videofile)
writeVideo(videofile,M)
close(videofile)

markerfacecolor i have not written collectively thats y this error is showing 
here i have not written w capital i have written in small lettre when i write w in capital problem solved
here also w i have written in small letter when written in capital error gone
here main problem is i have putted sin function as sind