Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Plotting simple pendulum

  1. Sep 29, 2012 #1
    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..
     
  2. jcsd
  3. Sep 29, 2012 #2

    jedishrfu

    Staff: Mentor

    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
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook