project on pendulum simulation
Objective: clear allclose allclc %inputsb=0.5;g=9.81;l=1;m=1; %initial conditiomtheta_0=[0;3]; %time pointst_span= linspace(0,20,500); %solve ode[t,results]= ode45(@(t,theta)ode_func( t,theta,b,g,l,m),t_span,theta_0); angular_disp=results(:,1);ct=1; for i=1:length(t_span) THETA=angular_disp(i); %coordinates of pendulum x0=0; y0=0;…