Modelling Pendulum Experiment Terms of reference Modelling 334 Technical report Authors H Barnard 25244337 2023 Department of Mechanical and Mechatronic Engineering Departement Meganiese en Megatroniese Ingenieurswese Privaat Sak X1, Private Bag X1, Matieland, 7602 Tel: +27 21 808 4204 | www.eng.sun.ac.za Plagiarism declaration I have read and understand the Stellenbosch University Policy on Plagiarism and the definitions of plagiarism and self-plagiarism contained in the Policy [Plagiarism: The use of the ideas or material of others without acknowledgement, or the re-use of one's own previously evaluated or published material without acknowledgement or indication thereof (self-plagiarism or text-recycling)]. I also understand that direct translations are plagiarism, unless accompanied by an appropriate acknowledgement of the source. I also know that verbatim copy that has not been explicitly indicated as such, is plagiarism. I know that plagiarism is a punishable offence and may be referred to the University's Central Disciplinary Committee (CDC) who has the authority to expel me for such an offence. I know that plagiarism is harmful for the academic environment and that it has a negative impact on any profession. Accordingly, all quotations and contributions from any source whatsoever (including the internet) have been cited fully (acknowledged); further, all verbatim copies have been expressly indicated as such (e.g., through quotation marks) and the sources are cited fully. I declare that, except where a source has been cited, the work contained in this assignment is my own work and that I have not previously (in its entirety or in part) submitted it for grading in this module/assignment or another module/assignment. I declare that have not allowed, and will not allow, anyone to use my work (in paper, graphics, electronic, verbal or any other format) with the intention of passing it off as his/her own work. I know that a mark of zero may be awarded to assignments with plagiarism and also that no opportunity be given to submit an improved assignment. Signature: Name: Henri Barnard .......................... Date: 10/05/2023 ............................. i Student no:25244337 ................ Abstract This report has taken a look into the feasibility of using mathematical modelling to model complex mechanical systems. The report focussed on assessing the model of a simple pendulum with the formula: 1 𝐽𝜃̈ + 𝐵𝜃̇ + 2 𝑚𝑔𝐿𝜃 = 0. The report decided on this model since it takes the damping coefficient into consideration unlike various other reports. After an experiment was conducted the data was analysed and this report confidently concludes that this particular model does a good job of describing the pendulum’s motion and that it is possible to model a physical system using a mathematical model but suggests that further investigations be done to support the findings of this report. ii Table of contents Page Plagiarism declaration ....................................................................................... i Abstract ........................................................................................................... ii List of figures .................................................................................................. iv List of tables .................................................................................................... v List of symbols ................................................................................................ vi Introduction..................................................................................................... 1 1 Methods.................................................................................................... 2 1.1 Equipment required ................................................................................ 2 1.2 Experiment set up ................................................................................... 2 1.3 Conducting the experiment .................................................................... 3 1.4 Data extraction ........................................................................................ 3 2 Results and Analysis .................................................................................. 5 2.1 Data analysis ............................................................................................ 5 2.1.1 Obtaining theoretical system parameters .................................. 5 2.1.2 Calculating damping coefficient and mass moment of inertia from experimental data .............................................................. 6 2.2 Comparing Experimental data and Theoretical data .............................. 8 2.2.1 Theoretical Data .......................................................................... 9 2.2.2 Experimental data ..................................................................... 10 2.2.3 Comparison................................................................................ 12 3 Discussion ............................................................................................... 13 4 Conclusions ............................................................................................. 15 5 References .............................................................................................. 16 Appendix A 17 Appendix B 18 iii List of figures Page Figure 1 Snapshot of pendulum befor it drops ....................................................... 2 Figure 2 Snapshot of the pendulum being tracked in Tracker ................................ 4 Figure 3 Screenshot of Inventor program showing the modelled Pendulum bar and its mass moment of inertia. ........................................................... 5 Figure 4 Screenshot of calculations done in SMath. ............................................... 6 Figure 5 Excerpt of Matlab code showing how J and B are calculated using backslash ............................................................................................... 7 Figure 6 Graph of Theoretical plot of angular displacement over time ................ 10 Figure 7 Excerpt of Matlab code for plotting angular displacement over time graph ................................................................................................... 11 Figure 8 Graph of experimental angular displacement over time ........................ 11 Figure 9 Both angular displacement graphs on the same axis .............................. 12 Figure 10 Graph of angular velocity over time in Tracker ..................................... 13 Figure 11 Graph of angular acceleration over time in Tracker .............................. 13 Figure 12 Graph of Angular displacement over time ............................................ 17 Figure 13 Graph of Angular velocity over time...................................................... 17 Figure 14 Graph of Angular acceleration over time .............................................. 17 iv List of tables Page Table 1 Variables and their types ............................................................................ 2 Table 2 Measurements of Pendulum: ..................................................................... 5 v List of symbols a0 coefficient of 𝜃̈ a2 coefficient of θ B Damping coefficient g Gravitational acceleration J Mass moment of inertia L Length of pendulum m Mass of pendulum r characteristic equation roots. T Period of swingmen pendulum t Thickness of pendulum w width of pendulum α Alpha β Beta ζ damping ratio θ Angular displacement of pendulum 𝜃̇ Angular velocity of pendulum 𝜃̈ Angular acceleration of pendulum ωd Natural frequency of pendulum ωn Damped frequency of pendulum vi Introduction Modelling enables us to represent various complex systems using simpler mathematical equations, which can be easily solved and analysed. This capability allows companies to save time and money. Moreover, modelling facilitates the study and enhanced understanding of the behaviour exhibited by complex mechanical systems without the need for conducting physical tests. The Modelling 334 course requires students to conduct experiments aimed at determining model parameters. This evaluation assesses whether students have attained ECSA Graduate attribute 4, which pertains to their proficiency in conducting experiments, investigations, and data analysis. The focus of this report is do conduct an investigation of a mathematical model of a simple pendulum in the form of: 1 𝐽𝜃̈ + 𝐵𝜃̇ + 2 𝑚𝑔𝐿𝜃 = 0. The objectives of the report are to determine the system parameters and to evaluate the model’s accuracy in describing a simple pendulum system. This report will explain the procedures used to conduct the experiment as well as how all the data was handled and processed. Furthermore, this report will do a thorough analyses of the data and explain how the different system parameters were calculated and/or measured using experimental data. Near the end of the report some important point regarding the report and the integrity of the report will be discussed. Most reports found online today do experiments with pendulums in the form of a point mass at the end of some string whereas this report focuses on a pendulum made of a bar. This has many more practical use cases in the real world as very few pendulums consist of solely a point mass at the end of a string. Furthermore, this report also takes the damping coefficient into account where it is normal seen as negligible in reports involving a simplified version of a pendulum. 1 1 Methods Pendulum 1.1 Equipment required • Pendulum • Pendulum stand • Scale • Calliper • Tape measurer • Video recorder (Phone Camera) • Bright coloured stickers • Note pad • Pencil Bright stickers Pendulum stand Figure 1 Snapshot of pendulum befor it drops Table 1 Variables and their types Variable Variable type Mass of pendulum Control Length of pendulum Control Width of pendulum Control Thickness of pendulum walls Control Initial angular displacement Independent Angular displacement Dependant Angular velocity Dependant Angular acceleration Dependant Period Dependant 1.2 Experiment set up 1. The length of the pendulum bar was measured using the tape measurer. 2. The width of the pendulum and the thickness of the thin walls were measured using the calliper. 2 3. The diameter of the bar connected to the top of the pendulum was measured using the calliper. 4. The weight of the pendulum was measured by using the scale and weighing the pendulum 5 times and taking the average of the result to get a more accurate value. 5. All the values were recorded by writing them done in a note pad. 6. Two bright orange stickers per placed 25 mm away from one another on the pendulum to serve as tracking points for tracker software and to set up various calibration points. 7. The pendulum was placed on the stand securely. 8. The stickers were ensured to be visible to the camera. 1.3 Conducting the experiment 1. The pendulum was raised to approximately 45 degrees and then let go to swing freely. 2. The freely swinging bar was then filmed using a phone camera. 3. Although the phone was attempted to be help still, after viewing the video it is apparent that the camera did shift while filming. 1.4 Data extraction 1. The video of the pendulum swinging was imported to Tracker, a program designed to track objects in a 2-dimensional plane. 2. The bright stickers were used to set up a calibration stick to give Tracker a scale of the pendulum. 3. A “point mass” was placed at both bright stickers. Tracker’s Autotrack feature was used to track the position of each sticker in each frame to create a mapping of the path that each sticker follows while the pendulum swings. 4. Two additional calibration points were placed at the top and the bottom of the pendulum stand to track and account for the drifting of the camera while filming. 3 5. Tables and graphs of all the relevant data were set up in Tracker and can be found in Appendix A. Origin axis Calibration stick Point mass tracking points Figure 2 Snapshot of the pendulum being tracked in Tracker 4 2 Results and Analysis 2.1 Data analysis 2.1.1 Obtaining theoretical system parameters 2.1.1.1 Moment of inertia Below shows a table of all the measurements that were taken of the pendulum. Table 2 Measurements of Pendulum: Variable Measurement L 0.5 m w 0.0195 m t 0.002 m m 0.595 kg d 0.01 m These measurements were used to recreate and model the pendulum in Inventor to get an accurate theoretical value for the mass moment of inertia of J = 0.050 kgm2. Figure 3 Screenshot of Inventor program showing the modelled Pendulum bar and its mass moment of inertia. 5 2.1.1.2 Damping coefficient The damping coefficient was calculated with the help of SMath Studio and equations found in (Kluever, 2015). It is important to note that gravitational acceleration, g, is assumed to be 9.81 at low altitude. Kluever(2015:214) Kluever(2015:221) Kluever(2015:221) Figure 4 Screenshot of calculations done in SMath. 2.1.2 Calculating damping coefficient and mass moment of inertia from experimental data 2.1.2.1 Data processing Tracker was used to set up tables with the values for angular displacement, angular velocity and angular acceleration. These tables were then copied and 6 pasted to an Excel spreadsheet. Then Matlab’s “Import Data" feature was used to import the data from Excel by selecting the relevant data and giving them appropriate variable names and storing each one of them in Matlab as 983x1 columns vectors. A 983x2 coefficient matrix was set up called A, existing of a column containing every 𝜃̈ value and every 𝜃̇ value, respectively. Next a second matrix, the solution matrix, called B is created. The Matlab’s backslash operator is used to determine that the mass moment of inertia, J = 0.0499 kgm2 and damping Figure 5 Excerpt of Matlab code showing how J and B are calculated using backslash coefficient, B = 0.0114 kg3/2m3. The figure above is an excerpt of Matlab code used to calculate the mass moment of inertia and the damping coefficient of the pendulum system. The full Matlab code can be found in Apendix B. The backslash operator (\) in Matlab performs matrix division or solves systems of linear equations. It provides a concise and efficient way to find solutions to linear equations by leveraging numerical algorithms and matrix factorizations. When you have a system of linear equations of the form AX = B, where A is an mby-n matrix, X is an n-by-p matrix of unknowns, and B is an m-by-p matrix of constants, the backslash operator computes the solution X such that AX = B. The backslash operator uses various numerical methods to solve the system depending on the properties of the input matrices A and B. The most common techniques employed by Matlab are LU decomposition and QR factorization. 1. LU Decomposition: • If matrix A is square and non-singular (i.e., invertible), Matlab performs LU decomposition to solve the system exactly. • LU decomposition factorizes matrix A into two matrices: L (lower triangular) and U (upper triangular). It can be written as A = LU. • Once A is decomposed, Matlab solves the system by solving two simpler equations: LY = B and UX = Y, where Y and X are intermediate matrices. 7 • 2. The LU decomposition method is efficient and provides an exact solution when A is non-singular. QR Factorization: • If matrix A is rectangular, singular, or the system is overdetermined (more equations than unknowns), Matlab uses QR factorization to find the leastsquares solution. • QR factorization decomposes matrix A into two matrices: Q (orthogonal) and R (upper triangular). It can be written as A = QR. • The QR decomposition allows Matlab to solve the system by transforming it into a simpler form, known as the least-squares problem. • The least-squares solution minimizes the sum of the squares of the residuals between AX and B, providing the best approximate solution when an exact solution does not exist. The backslash operator automatically determines the most appropriate method based on the characteristics of the input matrices. It selects LU decomposition for square, non-singular matrices and QR factorization for rectangular or singular matrices. Additionally, the backslash operator in Matlab has other useful features: • It can manage sparse matrices efficiently, taking advantage of their sparsity to optimize computations. • It can solve multiple systems of equations simultaneously by providing matrices B and X with appropriate dimensions. Matlab’s backslash operator is a very powerful tool and is extremely helpful and efficient when solving linear systems. 2.2 Comparing Experimental data and Theoretical data Matlab was used to first set up and plot both theoretical and experimental data and creating graphs. 8 2.2.1 Theoretical Data An equation for the angular displacement of the pendulum arm was created by applying theory in the following way. 1. First the initial mathematical model is considered: 1 𝐽𝜃̈ + 𝐵𝜃̇ + 2 𝑚𝑔𝐿𝜃 = 0. 2. Then the characteristic equation is determined to be: 1 𝐽𝑟 2 + 𝐵𝑟 + 2 𝑚𝑔𝐿 = 0. 3. Now the values for mass moment of inertia and damping coefficient of the pendulum that were determined earlier in the report on pages 5 and 6 can be substituted in and the following equation is created: 0.05𝑟 2 + 0.0112𝑟 + 1.4592 = 0. 4. There is a variety of different ways to calculate the roots of this equation and in this report, Matlab’s built in “roots” function is used and 2 complex conjugate roots are found being: 𝑟1,2 = −0.1118 ± 5.4011𝑖. 5. These values are used to set up the final equation that will be used in Matlab to create the graph of the theoretical angular displacement. The final equation is: 𝑦(𝑡) = 𝑒 𝛼𝑡 [𝑐1 cos 𝛽𝑡 + 𝑐2 sin 𝛽𝑡]. In this equation α is the real part of the root conjugate pair and β is the complex part of the conjugate pair. c1 is the initial angular displacement of the pendulum arm, which in this case is c1 = 35.4°, but is important to 𝜋 convert this into radians by multiplying it by 180 which is equal to 0.6178rad. c2 is the angular displacement of pendulum arm as time tends to infinity. For this damped system it is known that the angular displacement tends to 0 as time tends to infinity. Thus c2 = 0 rad and the 𝑐2 sin 𝛽𝑡 term can be discarded. 6. When substituting in all the knowns we are left with: 𝑦(𝑡) = 𝑒 −0.1118𝑡 [0.6178 cos(5.4011𝑡)]. 9 7. An array of t values is created using Matlab’s “linspace” function which creates a row vector of points spaced out linearly between a given start and end value, in this case from 0 to 17. 8. Matlab’s plot function is used to plot a graph of the expected angular displacement and we receive the following graph: Figure 6 Graph of Theoretical plot of angular displacement over time 2.2.2 Experimental data 1. Data from Tracker is exported to Matlab using the process described under point 4.1.2.1, but this time the time data is also exported to Matlab. 2. Matlab’s plot function is used to create a graph by plotting every angular displacement measurement made by Tracker with their respective time value. 10 3. The code for this procedure looks like this: Figure 7 Excerpt of Matlab code for plotting angular displacement over time graph 4. The following graph is produced: Figure 8 Graph of experimental angular displacement over time 11 2.2.3 Comparison When comparing the two results it is easy to start by comparing the two graphs. Matlab is used to plot these to graphs on the same axis: Figure 9 Both angular displacement graphs on the same axis From this graph one can clearly see that the experimental data does tend to follow the model closely in some sections. However, the theoretical plot seems to be less affected by damping, this could be due to the theoretical and experimental values for the damping coefficient and mass moment of inertia differs slightly. When comparing the theoretical and experimental system parameters there is some evidence that indicates that the mathematical model does a good job in accurately describing the model as both the mass moment of inertia and the damping coefficient are very similar with Jtheoretical = 0.05 kgm2 and Jexperimental = 0.0499 kgm2 and Btheoretical = 0.0112 kgm2/s and Bexperemental = 0.0114 kgm2/s. 12 3 Discussion There were a few results that did stand out as they were not expected. For instance, when plotting the data gathered by Tracker some abnormalities came to light like these last few points in the angular velocity graph created in Tracker which don’t follow the same smooth path as the rest of the data. Figure 10 Graph of angular velocity over time in Tracker The problem is even more exaggerated when examining the angular acceleration graph: Figure 11 Graph of angular acceleration over time in Tracker This discrepancy in of the data at these points in the graphs is most likely due to the manually placed points placed by the user when Tracker’s Autotracker could not find the point on its own. These abnormalities could have been lessened by keeping the camera more stable when filming the swinging pendulum, which would have reduced the reliability on the calibration point to track the moment of the camera. To try and lessen the impact of these abnormalities only data from between the time stamps 2.999 and 13.993 were used which don’t include any extreme outliers to what we expect to see. 13 Another surprise was the striking difference in the rate of decay in the angular displacement, where the theoretical model initially decays much faster that the experimental data does and then slows down where the experimental data seems much more linear. This could be due to the model assuming that the magnitude of the damping is dependent on how fast the pendulum is swinging due to the 𝜃̇ term. However, in actuality friction from the connection between the supports of the pendulum stand and the rod connected to the pendulum is the main force effecting the damping coefficient. Since friction does not vary with the speed an object travels at this results in a much more linear decay in the angular displacement. 14 4 Conclusions With how important the mathematical modelling of a system into a simpler mathematical equation is in an industry filled with complex mechanical systems, it is vital to determine how effective mathematical models are at describing how a system would react and behave in specific conditions. In this report an investigation was launched with the objective of determining how trustworthy a model can be in describing the behaviour of a mechanical system. It has been determined that the model : 1 𝐽𝜃̈ + 𝐵𝜃̇ + 𝑚𝑔𝐿𝜃 = 0 2 describes the physical system fairly well but not extremely accurate. Mathematical models can be used describe a mechanical system, but it is recommended that these models be used merely for approximations as the results in this case are not reliable enough to base important decisions on as the theoretical data does not accurately represent the experimental data. Further investigations can be done on more complex systems to determine whether these findings correlate to other systems as well, but the findings in this report are satisfactory for the objective of this report. 15 5 References Kluever, C.A. 2015. Dynamics Systems Modelling, Simulation, and Control 2nd addition. USA: Wiley. 16 Appendix A A.1 Tracker graphs Figure 12 Graph of Angular displacement over time Figure 13 Graph of Angular velocity over time Figure 14 Graph of Angular acceleration over time 17 Appendix B % Theoretical data. L = 0.5; m = 0.595; g = 9.81; w = 0.0195; d = 0.01; J = 0.05; t1 = 11.777; t2 = 12.360; T = t2-t1; thetaInitial = 35.4; a0 = 0.5*m*g*L a0 = 1.4592 a2 = J a2 = 0.0500 NatFrequency = sqrt(a0/a2) NatFrequency = 5.4023 DampFrequency = 2*(pi/T) DampFrequency = 10.7773 zeta = a2/(2*sqrt(a0)) zeta = 0.0207 B = 2*zeta*NatFrequency*a2 B = 0.0112 p = [J B 0.5*m*g*L] p = 1×3 0.0500 p1 = 1×3 1.0000 0.0112 1.4592 0.2236 29.1847 18 Roots = roots(p) Roots = 2×1 complex -0.1118 + 5.4011i -0.1118 - 5.4011i r = 2×1 complex -0.1118 + 5.4011i -0.1118 - 5.4011i Alpha = real(Roots(1)) Alpha = -0.1118 Beta = imag(Roots(1)) Beta = 5.4011 td = linspace(0,20,1500) td = 1×1500 0 0.0133 0.0267 0.0400 0.0534 0.0667 0.0801 ⋯ thetatheoretical = exp(1).^(Alpha.*td).*(thetaInitial*(pi/180).*cos(2*Beta.*td)) thetatheoretical = 1×1500 0.6178 0.3973 ⋯ 0.6105 0.5906 0.5585 0.5149 0.4608 plot(td,thetatheoretical) title("Theoretical plot of angular displacement of the Pendulum") xlabel("time (s)") ylabel("Angular displacement (rad)") xlim([0 17]) 19 % Experemental Data Theta; ThetaDot; ThetaDoubleDot; t; Theta1 = Theta*(pi/180); ThetaDot1 = ThetaDot*(pi/180); ThetaDoubleDot1 = ThetaDoubleDot*(pi/180); figure() plot(t,Theta1) xlim([0 16.358]) title("Experemental plot of angular displacement of the Pendulum") xlabel("time (s)") ylabel("Angular displacement (rad)") 20 figure() plot(t,ThetaDot1) xlim([0 16.358]) figure() plot(t,ThetaDoubleDot1) xlim([0 16.358]) 21 % Calculating J and B from experimental Data % only using data between t = 2.999 and t = 13.993 A = [ThetaDoubleDot1(181:841) ThetaDot1(181:841)] A = 661×2 -49.3465 -49.9734 -41.4602 -41.1018 -25.2212 -9.7338 -18.6052 -15.1464 3.9911 28.3584 ⋮ -1.4099 -2.2215 -3.0841 -3.6440 -4.3478 -4.6654 -4.5046 -5.2543 -5.2733 -4.8212 B = -0.5*m*g*L*Theta1(181:841) B = 661×1 -0.6665 -0.6230 -0.5585 -0.4731 -0.3813 -0.2617 -0.1545 -0.0427 0.1010 0.2137 ⋮ 22 sol = A\B sol = 2×1 0.0125 0.0029 Jexperemental = sol(1,1)*4 Jexperemental = 0.0499 Bexperemental = sol(2,1)*4 Bexperemental = 0.0114 % Comparing Theoretical data to Experemental data figure() plot(t,Theta1) hold on plot(td,thetatheoretical) hold off legend("Experemental", "Theoretical") title("Plot of angular displacement of the Pendulum") xlabel("time (s)") ylabel("Angular displacement (rad)") xlim([0 17]) 23