Starting with a displacement function, can I use ODE 45 to calculate acceleration?

조회 수: 8 (최근 30일)
Hello,
I am trying to create a generic model for a spring-damper system that is experiencing base excitation. I want the function input to be the position/displacement function rather than a known velocity or acceleration.
I see a lot on here for ODE 45 for differential equations and integrating with a known velocity or acceleration. Is it possible to set it up to go the other way? I was hoping to see if there was a way to do this with ODE 45 instead of now just stating my function as the acceleration. I essentially want to create something that models the force transmitted to a mass from a known input. I thought there would be something already out there, but I just haven't found it yet. I may have just been staring at the problem too long.
  댓글 수: 5
Sean Griffin
Sean Griffin 2019년 10월 21일
I have the equations needed for the sprung mass. But my hiccup is that I have no explicit form of the velocity and acceleration of the unsprung input. This is meant to be a forward-dynamics simulation where a student gets to play with the dampening and spring coefficients in an app (separate GUI I've developed). So given the displacement function (their visual of the terrain the vehicle is about to drive over), what is the resulting force felt on the sprung mass. So the sprung mass's position, velocity, and acceleration are all depended on the user inputs, and the selected terrain. I'm just having issues trying to have ODE45 do the derivative of the input function. I was trying to do numerical estimations, but it's just not working. Thus why I'm asking if it's possible to start with a position and have ODE45 work the needed velocity and acceleration of the input (first two entries of my z vector).
I haven't tried using state space yet. I thought I was using ODE45 appropriately, but was just feeding it the wrong information. Is there a way to do this with ODE45? Or is this too much of a stretch for what it was designed for and should I try using state space instead?
Thanks again for your help!
Stephan
Stephan 2019년 10월 21일
편집: Stephan 2019년 10월 21일
Excuse me, if I'm completely wrong, but as far as I understand it, ode45 is a solver for ode's, which means that it's integrating. If I understood you correctly, the idea is to take derivatives. ode45 is not suitable for this.

댓글을 달려면 로그인하십시오.

채택된 답변

John D'Errico
John D'Errico 2019년 10월 21일
편집: John D'Errico 2019년 10월 21일
You cannot differentiate data using a ODE solver.
Think of an ODE solver as a numerical integration tool. In fact, you can perform numerical integration using an ODE solver. So it is going the wrong way for what you want to do. Just because it has the word differential in it, does not mean it will differentiate your data.
If you have a displacement function, then simply differentiating it twice will give you acceleration. For example, if you take displacements in x and y as a function of time, then the first derivative will give you velocities in x and y. Then the second derivative will yield accelerations.
If you have data points that define the displacement, then you can use tools like gradient to differentiate the data, providing an approximate acceleration. Or you can interpolate the points using a spline, then differentiate it twice to yield an approximate acceleration.
In any case, remember that differentiation is a noise amplifying process, so any noise in the data will be amplified in the acceleration estimate.

추가 답변 (1개)

Sean Griffin
Sean Griffin 2019년 10월 22일
편집: Sean Griffin 2019년 10월 22일
Thank you all very much for clarifying. I'll stop putting a square peg in a round hole with ODE45.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by