Solving ODE
Objective: clear all close all clc %vector consisting of time steps t_span=linspace(0,20,500); %get the output in 2 matrices [t,result] = ode45(@(t,y) pendulum(t,y,0.05,1,9.81,1),t_span,[0;3]); %the result matrix has 2 columns one containing values of y(angle) and dy/dt(derivative) %we take the sin and cos to get the position of…