Solving an Elastic Pendulum Equation with Matlab/Excel

  • Context: MATLAB 
  • Thread starter Thread starter nneutrino
  • Start date Start date
  • Tags Tags
    Elastic Pendulum
Click For Summary

Discussion Overview

The discussion revolves around transforming the Newtonian solution of motion equations for an elastic pendulum into numerical solutions using Matlab or Microsoft Excel. Participants explore the use of Euler's Method and the Runge-Kutta Method for this purpose, focusing on the sequence of equations necessary for implementation.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant seeks guidance on coding the equations for an elastic pendulum in Matlab or Excel, specifically asking for the order of equations needed for numerical integration.
  • Another participant suggests starting with a simple Euler integrator but emphasizes the importance of checking conservation laws, such as energy conservation, to avoid numerical errors.
  • A third participant expresses confusion regarding the overall plan and previous discussions, questioning whether the original poster has a working simulation of a pendulum and how to incorporate the spring's effects into the equations.
  • The original poster confirms they have a simulation for a rod pendulum and a complete set of equations but seeks specific guidance on the sequence of these equations for coding.
  • The original poster specifies an initial angle of 90° for the simulation and expresses a preference for a solution in Microsoft Excel.

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on the best approach to coding the equations or the specific sequence required. Multiple viewpoints on the use of numerical methods and the clarity of the problem remain evident.

Contextual Notes

There are limitations regarding the clarity of the equations and the specific implementation details, as well as the potential for confusion about prior discussions and the overall approach to the problem.

nneutrino
Messages
7
Reaction score
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?
 
  • Like
Likes   Reactions: scottdave
Physics news on Phys.org
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.

nneutrino said:
I know all the equations
So: what are the equations, how do you work them around to an algorithm ?

And some free advice: use a simple euler integrator
 
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!
 
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.
nneutrino said:
When we have solid rod instead of spring I can solve this problem in Microsoft Excel either with Euler´s method or Runge Kutta method, but that spring makes this problem hard for me.
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 ?
 
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
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 32 ·
2
Replies
32
Views
3K
  • · Replies 18 ·
Replies
18
Views
6K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K