Question: Hello Expert, please help solve the following question using MATLAB QUESTION 3 ( 15 marks) The Hamiltonian mechanics can be used to describe dynamic systems

Hello Expert, please help solve the following question using MATLAB

Hello Expert, please help solve the following question using MATLAB QUESTION 3

( 15 marks) The Hamiltonian mechanics can be used to describe dynamic

QUESTION 3 ( 15 marks) The Hamiltonian mechanics can be used to describe dynamic systems such as a simple pendulum which involves energy changes between kinetic and potential over time. The method is particularly powerful in complex mechanical systems without the constraints of forces and coordinate systems. You have been assigned to analyzed the dynamic motion of a simple pendulum with a bob of mass m (g) suspended to a string of length L (m) with negligible mass. The generalized coordinate of the system is the angle (radians) made by the string. The equation of motion for the pendulum can be described by the 2nd-order ordinary differential equation (ODE): , 2 de - mg sin O L = ml dt The 2nd-order ODE can be solved as a set of 1st-order ODEs, as shown below. Here, z is a 'dummy' variable. de = Z dt dz dt I sin 0 The two 1st-order ODEs above are coupled and must be solved simultaneously. i.e., the solutions are dependent on each other and therefore cannot be solved individually. The first iteration will solve for 0, and z, using initial conditions , and zo. The second iteration will solve fore, and zz using , and Z1, and so forth. You are strongly encouraged to complete a few iterations by hand to fully understand the process. Q3(a) (1 marks) In the midpoint2.m file, complete the function file to perform the midpoint method to solve two 1--order ODEs simultaneously. Q3(b) (2 marks) In the Q3b.m file, consider the initial conditions (0) = 50 and z(0) = 0. Parameters of the ODE are: m = 1kg, g = 9.81 m/s?, and L= 0.5 m. de Solve for the angle of the pendulum and the angular velocity dt using the midpoint21) function written in Q3a with a time step of 0.001s from t = 0 to 10s. In figure (4), plot the following in 2-by-1 subplot arrangement. [Top panel] (degrees) against t(s). de [Bottom panel] (degree/s) against t (s). dt Q3(c) (3 marks) In the Q3c.m file, use the midpoint2() function to solve the angle of the pendulum with L = 0.1, 0.2, 1, 2, 2.5, 3 m using a time step of 0.001s. Use the same initial conditions and parameters as in Q3b, unless otherwise specified in this question. In figure (5), produce a 3-by-2 subplot of 8 (deg) against t (s) for each value of Las solid lines. Use the RGB values defined in the 'colourmap' variable as provided below to colour solutions from the smallest L to the largest L of the subplot. Specify the string length in the title of each subplot. RGB values colourmap = [228 26 28; 55 126 184; 77 175 74;... 152 78 163; 255 127 0; 166 86 40; 247 129 191]/255

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!