View Single Post
  #3   Spotlight this post!  
Unread 22-12-2016, 18:56
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,494
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: numerical solution of differential equations

What surprises me more than the gain in amplitude for Euler (which is pretty easy to guess if you consider what happens to energy at different points) is the excellent prediction of the period. I'll have to give this a look.

I was able to do a version without the two extra columns that tracked pretty closely, using the parabolic formula for constant acceleration to calculate the next position, and the average acceleration assuming constant jerk (x''') to calculate the next velocity.

Code:
x[n+1]   =  x[n]  + dt*(x'[n]  + x''[n]*dt/2)
x''[n+1] = -x[n+1] 
x'[n+1]  =  x'[n] + dt*(x''[n] + x''[n+1])/2
Attached Files
File Type: xls parabolic.xls (63.5 KB, 2 views)
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 23-12-2016 at 11:16. Reason: Fixd sign on second equation, formatted cleaner
Reply With Quote