Solving an Elastic Pendulum Equation with Matlab/Excel

In summary: MatlabIn summary, the person is asking for the order of the equations in a code to solve a spring-elastic pendulum problem, and is concerned with the small angle approximation. They want to solve the problem in either Microsoft Excel or Matlab, but are concerned about the difficulty of the problem with a spring instead of a rod. They also want to solve the problem with an initial angle of 90°.
  • #1
nneutrino
7
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 scottdave
Physics news on Phys.org
  • #2
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
 
  • #3
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!
 
  • #4
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 ?
 
  • #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
 

Related to Solving an Elastic Pendulum Equation with Matlab/Excel

What is an elastic pendulum equation?

An elastic pendulum equation is a mathematical model used to describe the motion of a pendulum with a flexible or elastic string or rod. It takes into account the elasticity of the string or rod, which affects the period and amplitude of the pendulum's oscillations.

Why would I need to solve an elastic pendulum equation?

Solving an elastic pendulum equation can provide valuable insights into the behavior and characteristics of a pendulum with an elastic string or rod. It is often used in physics and engineering to design and analyze pendulum systems.

How can I solve an elastic pendulum equation with Matlab?

To solve an elastic pendulum equation with Matlab, you can use the built-in function "ode45" which solves ordinary differential equations. You will need to define the equation and initial conditions, and then use the function to generate a numerical solution.

Can I use Excel to solve an elastic pendulum equation?

Yes, you can use Excel to solve an elastic pendulum equation. You can create a table to calculate the position and velocity of the pendulum at different time intervals, and then use Excel's built-in functions such as "VLOOKUP" to plot the motion of the pendulum.

Are there any limitations to solving an elastic pendulum equation with Matlab/Excel?

Yes, there are some limitations to solving an elastic pendulum equation with Matlab/Excel. These programs use numerical methods to solve the equation, which may not provide exact solutions. Additionally, they may not be suitable for more complex pendulum systems with multiple degrees of freedom.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • Introductory Physics Homework Help
Replies
14
Views
542
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • Introductory Physics Homework Help
Replies
9
Views
805
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
Back
Top