Question: Please write this code in MATLAB AND PLEASE ASNSWER ALL THE PART.... 1. Pendulum ODE For the following problem, use ode45. Consider a pendulum of
Please write this code in MATLAB AND PLEASE ASNSWER ALL THE PART....

1. Pendulum ODE For the following problem, use ode45. Consider a pendulum of length I moving in the xy plane. The pendulum is fixed with a pin on one end and a mass at the other. For this problem, use g = 9.817, and 1 = 5 m. The differential equation governing the pendulum's motion is + sin(O) = 0 In a class in ODEs (or physics), this equation would be linearized to the following result so that an analytical solution could be obtained + of g = 0 1 Which is a good approximation when is small. But this is a class in numerical methods! We are not hindered by such petty obstacles. Solve the system using both differential equations and compare the results. Solve both above equations using ODE45 on t e [0,5], At = 0.1 with 0(0) 16.0(0) = 0 i) Save the nonlinear Ononlinear(t) on HW7_1.dat ii) Save the linear Olinear(t) on HW7_2.dat iii) Save the difference (error) between the two, Ononlinear(t) Olinear (t), on HW7_3.dat
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
