Simulation and Animation of a Linear and Nonlinear Pendulum Model

版本 1.0.0.0 (7.6 KB) 作者: James Allison
Demonstrates how to use both movie2avi and VideoWriter to generate avi files from simulation data.
2.0K 次下载
更新时间 2012/4/10

查看许可证

AnimatePendulum.m simulates and animates a simple pendulum using both linear and nonlinear dynamic models. A larger difference is observed between linear and nonlinear models when maximum angular position is large. This condition can be achieved by specifying either a large initial angle or velocity.

After simulation of both the linear and nonlinear models the code steps through each time step and plots the pendulum as well as its position and velocity trajectories. These plots are recorded using the getframe command, and then used to produce a video of the animation using both the movie2avi and VideoWriter commands.

Several videos based on this code are available on YouTube:

http://www.youtube.com/watch?v=X-OCz9lIiY4 (linear simulation)
http://www.youtube.com/watch?v=8WE6HsIopO0 (small angle comparison)
http://www.youtube.com/watch?v=XI7vcWr-D_8 (large angle comparison)

引用格式

James Allison (2024). Simulation and Animation of a Linear and Nonlinear Pendulum Model (https://www.mathworks.com/matlabcentral/fileexchange/36119-simulation-and-animation-of-a-linear-and-nonlinear-pendulum-model), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Assembly 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0