Iteration calculation inconsistencies
Iteration calculation inconsistencies
(OP)
I am currently performing an iteration calculation for a model that involves variably changing acceleration. The acceleration is dependent on position for this model. When I plot the data with respect to position, the data is accurate. However, when I plot it with respect to time the acceleration, speed, and position values are OK, but the time span that the motion undergoes is very inaccurate. It gets even worse when I try to decrease the time interval for each iteration. The time span that it is suppose to be is approximately 5-7 ms, but with small time intervals I get time spans that go from 1.4 ms to as small as 1e-4 ms (using a time interval as large as 0.1 ms and as small as 1e-8 ms).
Is this just computation issues within MATLAB or is this a major error within the code?
Is this just computation issues within MATLAB or is this a major error within the code?
RE: Iteration calculation inconsistencies
Cheers
Greg Locock
New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?
RE: Iteration calculation inconsistencies
Your code or Matlab? From what little info you've provided, my first guess is that you are solving an ODE problem using a variable step built-in solver, which is dynamically adjusting its step-size based on the required error tolerance - typically shrinking it when current conditions make the equations stiffen up.
- Steve
RE: Iteration calculation inconsistencies
I have tried to set up my system as a PDE but the only relation I have is that the acceleration is dependent upon angular position and I have absolutely no reference to time except the typical conditions of 0 displacement at time=0.
Due to this, I have tried to set up small time step iterations that assume near constant acceleration within the time step and then calculate the position and speed using the standard kinematic equations. With the new position I adjust the acceleration as such for the next iteration. In my point of view, doing it this way at least has references to both position and time. However, using this method is only consistent when comparing acceleration and speed to position instead of time. I am thinking that time becomes an arbitrary reference frame and adjusts itself according to the time interval that is used for each iteration.
RE: Iteration calculation inconsistencies
TTFN

FAQ731-376: Eng-Tips.com Forum Policies
Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers
RE: Iteration calculation inconsistencies
RE: Iteration calculation inconsistencies
Then you mentioned PDE. It's not clear what type of pde you wouild be solving.
Might be interesting to know a little more details on the problem and your approach. Lumped element ode? Using ode45?
=====================================
(2B)+(2B)' ?
RE: Iteration calculation inconsistencies
TTFN

FAQ731-376: Eng-Tips.com Forum Policies
Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers
RE: Iteration calculation inconsistencies
- Fixed time-steps as an input to the solver
- Inner convergence loop based on meeting some kind of error condition
- Some derivatives assumed constant across time-step (i.e. Euler integration!)
And you are finding that a smaller time-step runs faster, although you do not clearly distinguish between simulation time and wall time. I can't tell whether (a) each time-step is faster when the step-length is smaller (the inner convergence loop needs less iterations), or (b) the whole simulation completes more quickly with (more) smaller time-steps.
At least that's what I can glean from the posts so far.
- Steve