The goal of this case study is to show how MATLAB and various toolboxes can be used together to solve an imaging problem. The specific problem shown here is a science experiment. Given a pendulum, measure gravity. The mathematics are well defined by classical physics. Gravity depends on the length of the pendulum and the period of oscillation. An example data set is included in which a ball suspended by a string was used as a pendulum. A captured video of the swinging ball and the time stamps for each video frame are stored in a native MATLAB data file. Another such file contains the predetermined pixel resolution associated with this camera setup.
The Image Acquisition Toolbox was originally used to acquire a video of the oscillating pendulum directly into MATLAB. One advantage of this approach over importing video data from an AVI file was having direct control of the desired image resolution and frame rate of the camera at the device level. It was also convenient being able to work with the camera from within the MATLAB environment instead of having to deal with additional applications and intermediate movie files.
The Image Processing Toolbox was used to find and extract the location of the moving ball in each frame. A circle was then fitted to the ball positions to find the center of rotation, average radius and radial variation or spatial measurement error. The positions were transformed from cartesean to polar coordinates, which produced a damped harmonic motion of angular positions versus time.
The System Identifaction Toolbox was used to fit an autoregressive moving average (ARX) model to the damped sinusoid. This resulted in a discrete-time transfer function description of the harmonic motion. The discrete mathematical model was then transformed to a continuous-time domain transfer function expressed in the frequency domain using Laplace "s" notation. From the complex poles of the transfer function, the radian frequency of oscillation was extracted and then inverted to get the period of oscillation. In addition, variation in time stamps for each frame were determined to estimate temporal measurement error.
Finally, the Symbolic Math Toolbox was used to manipulate the governing equations of motion from physics. This simplified the algebraic task of solving for the measured gravity value. It also simplified the calculus to determine total stack-up error in the gravity measurement.
Robert Bemis (2022). Gravity Measurement Case Study (https://www.mathworks.com/matlabcentral/fileexchange/3700-gravity-measurement-case-study), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!