Why is during intgration of velocity signal in simulink exhibits drift in position signal ?
5 views (last 30 days)
Show older comments
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191529/image.jpeg)
I have an input signal which is velocity v(t). Normally when you want the position signal x(t) then you can use the integrator block in simulink and it gives you the position signal. When i do this i got a position signal but it looks like it is drifting in time. Does someone have an explanation for this phenomena??
0 Comments
Answers (2)
Jim Riggs
on 2 Jul 2018
Edited: Jim Riggs
on 2 Jul 2018
If you have two different simulation of the same thing that show different results, it is clearly an indication of an implementation difference. You should check your integrator implementation to see if it is an inherently inaccurate one (e.g. Euler integration). Is the integrator a fixed-step or variable step integrator? If variable step, how is the error controlled? These are all fundamental parameters which will significantly effect the numerical accuracy.
Looking at the integrator is just the first step. What about the over-all simulation time step and the other models in the two simulations? How do they compare/differ?
0 Comments
Captain Karnage
on 19 May 2023
This is an old question, and I can't say for sure without seeing your exact Simulink model, but here is a potential answer. When you take the integral, you lose your initial conditions. The simplest example of this is a line. Standard x,y equation for a line is
y = mx + b
if you take dx/dy, you just get m. When you integrate that, now you get mx. You've lost the b. The b is your initial condition.
A way to overcome this is that the integral block can add a port for initial conditions. Go to the block paramters, then "initial condition source" and select "external".
![Integrator Block Parameters](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1388734/Integrator%20Block%20Parameters.png)
Then connect your original position signal with the initial condition port that appears.
If you're still seeing some drift, another option is to add an external reset as well (the line above the initial condition source). Then you have to determine what is the best reset signal - usually it's a zero crossing but it could be something else depending on your specific system. Then each time it is reset, it will also reset the initial conditions to whatever is connected.
0 Comments
See Also
Categories
Find more on Sources in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!