1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Spring Pendulum

  1. Apr 19, 2017 #1
    Hi guys,
    I need to transform Newtonian solution of motion equation for spring (elastic) pendulum into Matlab or Microsoft Excel. I want to use Euler´s Method (or Runge Kutta Method) of numerical solution for that problem. I know all the equations but I have a problem with making some code from them. In which order should I write those equations to some of those programs and which equations are necessary?
  2. jcsd
  3. Apr 20, 2017 #2


    User Avatar
    Science Advisor
    Homework Helper
    2017 Award

    Hi nn,

    Here at PF we encourage folks to start something so we can help them by asking questions, giving hints and perhaps propose some corrections. So it would be best if you made a start and then we'll help you along.

    So: what are the equations, how do you work them around to an algorithm ?

    And some free advice: use a simple euler integrator
  4. Apr 20, 2017 #3


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    Using a simple Euler integrator is only good advice if you want to provide insight into what can go wrong in integrating differential equations. It's important to check (at least) the conservation laws (in this case energy conservation) to at least see whether things go wrong due to accumulation of errors. Using a low-order solver usually forces you to make the time-step size small, but then you often cumulate numerical errors!
  5. Apr 20, 2017 #4


    User Avatar
    Science Advisor
    Homework Helper
    2017 Award

    First things first; we can always concentrate on the integrator later on.
    nn started several threads and by now I don't know what the plan is, nor what has already been covered and what is to be picked up next.
    Contradicts post #1 here somewhat (at least for me).

    Do you already have a working simulation of a pendulum and now want to allow for stretch (spring instead of rod) in the equations ?

    @nneutrino : Or is your problem that you have a full set of equations and don't know how to discretize them ?

    Also: are you clear now on the small angle approximation for the pendulum ? Do you want it in or out ?
  6. Apr 20, 2017 #5
    1. I already have simulation of a pendulum with rod but my problem is how I have already said elastic pendulum with spring.
    2. Yes, I have full set of equations and I find it useless to write them all here. So I am asking for order of those equations in my code (I know how programing in Matlab works or how functions in Microsoft Excel are written) I need to know the sequence of concrete equations. M. Excel example: 1. step (time) t_n=t_n-1+dt; 2. step (acceleration) a_1= some formula... 3. step (velocity) formula 4. step (position) etc. (I am asking for sequence of concrete formulas which I understand because I understand the problem of elastic pendulum. If something is not clear about formulas I will ask)
    3. Initial angle should be 90°
    By the way I prefer Microsoft Excel solution
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted

Similar Threads - Spring Pendulum Date
I Loaded Spring Jan 12, 2018
A Pendulum with spring instead of rod Apr 17, 2017
Spring pendulum, Kinetic Energy Apr 4, 2015
Spring Pendulum Jul 15, 2013
Spring pendulum Nov 3, 2011