MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Kiran Sagar
on 30 Dec 2012

i have recently made a simulink model of a mechanical system, though complex in nature, but basically it is a second order ODE.

i think that my plant model is stable statically, and neutrally stable dynamically. yet i am getting results showing dynamic instability. i am thinking about possible reasons for this.

kindly clarify whether numerical scheme can lead to dynamic instability of a neutrally stable plant.

configuration parameters: variable step, step size- auto, tolerances- auto.

*No products are associated with this question.*

Answer by Matt J
on 30 Dec 2012

Edited by Matt J
on 30 Dec 2012

Accepted answer

Because a neutrally stable system (as I know the term) is on the threshold of instability, it definitely makes sense that numerical inaccuracies in the implementation of the plant can render it unstable.

Consider a system that simply multiplies its input by some constant

y=c*x

For c=1, it is neutrally stable at all inputs, x, whereas for any c>1, it is unstable. If c was the output of approximate calculations, then even though c may supposed to be 1 (stable), imprecision in the calculations can make it >1, i.e., unstable.

Answer by Jan Simon
on 30 Dec 2012

Edited by Jan Simon
on 30 Dec 2012

Due to round-off errors and local discretization error the numerical and mathematical behavior is expected to be different. A simply example is the differential quotient as approximation of the derivative:

d = (f(x+h) - f(x)) / h;

If h is large, the linearization error is large. If h is small, the difference of the function evaluations can be such tiny, that the cancellation error dominates the result. Therefore the numerically determined derivative has a limited accuracy only, as a rule of thumb in the magnitude of `sqrt(eps)`. Equivalent arguments appear for the two-sided differential quotient and any other scheme also.

Because all numerical ODE solvers are based on evaluating linearized derivatives, the limited accuracy is a fundamental effect, which cannot be avoided. Reducing the relative and absolute tolerances helps, but only until a certain limit, when the cancellation error dominates the linearization error and the accumulation of the round-off errors gets more important due to the higher number of steps.

However, an unexpected instability can be caused by a modelling error also. Did you validate the model exhaustively? How did you check the dynamic instability? Is the model continuously differentiable (I ask this, because in the past I saw so many users in this forum, who used integrands with discontinuities)?

## 1 Comment

## Azzi Abdelmalek

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/57645#comment_119789

Can you post your model?