Plotting simple pendulum

  • Thread starter tigertan
  • Start date
  • #1
25
0

Main Question or Discussion Point

I'm really confused at the moment and would quite appreciate some guidance.

I've got little to no background in Matlab and am needing to plot a simple pendulum.

I have found the equation of motion which is q(doubledot) = -(g/l)sin(beta)

I don't know how to go about this?

After declaring the variables:

runtime = 50; %duration of simulation in seconds
g = 9.8;
startingangle = 20; %starting angle in degrees
initialvelocity = 0;
length = 1;


How do I go about this?
Does anyone have any good tutorials to help me out?

I know I need to incorporate some function called ode45..
 

Answers and Replies

  • #2
11,280
4,741
ode45 is the runge-kutta ordinary differential equation solver basically you need to provide a step function that it can then call repeatedly to integrate it and generate a solution.

Here's some info from MATLAB support that may help:

http://www.mathworks.com/help/matlab/ref/ode113.html?BB=1
 

Related Threads for: Plotting simple pendulum

Replies
5
Views
6K
Replies
6
Views
70K
Replies
1
Views
2K
Replies
1
Views
3K
  • Last Post
Replies
2
Views
2K
Replies
7
Views
3K
Replies
2
Views
11K
Top