# How to simulate a spherical pendulum in matlab?

17 次查看（过去 30 天）
Bas Siebers2015-2-10

Hi,
I want to simulate a spherical pendulum in matlab. So far, I have found the equation of motion of the spherical pendulum:
But I haven't a clue how to simulate this. Any help whil be useful.
Kind regards, Bas

### 采纳的回答

Roger Stafford 2015-2-11

Bas, you have a sign error in the gravity term. It should be:
-g*sin(phi)/L
Use one of matlab's 'ode' solvers to numerically solve these equations. Read about how to use them at:
http://www.mathworks.com/help/matlab/math/ordinary-differential-equations.html
Note that you would have numerical accuracy difficulty if the angle phi approaches near zero because of the division by sin(phi) in the first equation. At that point theta would change very rapidly. That is inherent in the physical situation as measured by the two angles.
##### 5 个评论显示 4更早的评论隐藏 4更早的评论
Bas Siebers 2015-4-22
Hi Roger,
I started again with solving this problem. Do you known how to transform my coordinates to cartesian coordinates?

### 更多回答（1 个）

Youssef Khmou 2015-2-11

### 类别

Find more on Assembly in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by