MATLAB Answers


please help me solve this problem: Discontinuities detected within algebraic...

Asked by zhang xinghui on 4 May 2012

we know that sign(x)|x|^a(for constant a>0) is continuous, but in this model, using a sign block always results discontinuous or something wrong, how can I solve it? the running result is the following:

Warning: Block diagram 'mysimulink1' contains 1
algebraic loop(s). To see more details about the loops
use the command line Simulink debugger by typing
"sldebug mysimulink1" in the MATLAB command window. To
eliminate this message, set the Algebraic loop option
in the Diagnostics page of the Simulation Parameters
Dialog to "None" 
Found algebraic loop containing:
  'mysimulink1/Math Function'
  'mysimulink1/Sign2' (discontinuity)
  'mysimulink1/Sign1' (discontinuity)
  'mysimulink1/Sign' (discontinuity)
  'mysimulink1/Sum2' (algebraic variable)
  'mysimulink1/Abs' (discontinuity)
  'mysimulink1/Math Function1'
  'mysimulink1/Product2' (algebraic variable)
Warning: Discontinuities detected within algebraic
loop(s), may have trouble solving 
Warning: Using a default value of 200 for maximum
step size.  The simulation step size will be equal to
or less than this value.  You can disable this
diagnostic by setting 'Automatic solver parameter
selection' diagnostic to 'none' in the Diagnostics
page of the configuration parameters dialog 
Warning: Convergence problem when solving algebraic
loop containing 'mysimulink1/Math Function' at time
0.  Simulink will try to solve this loop using
Simulink 3 (R11) strategy. Use
feature('ModeIterationsInAlgLoops',0) to disable the
strategy introduced in Simulink 4 (R12) 

I am a student now and have been troubled by this problem for a long time, sincerely hope every talent can help me solve it, and I will be very grateful...


Please clarify: does sign(x)|x|^a(a>=1) mean
sign(x) * abs(x)^a subject to a>=1 ?

Is your "a" a constant or a run-time value? If it is a run-time value, what mechanism has been used to ensure that Simulink knows the constraint a>=1 ? If it did not know that constraint then because |x| could be 0, it would have to assume |x|^a could be 0 to some negative power.

here "a" is a constant. in fact, "sign(x)*abs(x)^a" is continuous for any "a>0".

Log in to comment.


No products are associated with this question.

1 Answer

Answer by K E
on 4 May 2012

You might want to get rid of the algebraic loop in your model. The algebraic loop solver may be doing something strange: 'The algebraic loop solver uses a gradient-based search method, which requires continuous first derivatives of the algebraic constraint that correspond to the algebraic loop'. Information on getting rid of algebraic loops can be found here. As a side benefit, your Simulink model will run faster without the algebraic loop, but breaking it (inserting a Unit Delay, for example) may change the dynamics.


Show 1 older comment

Correct: the state converges to zero before 42059765151.70426 strictly but too late.

If you are having trouble eliminating an algebraic loop with a Unit Delay, you might want to try the ashow command ( to see where the algebraic loop is in your Simulink model, just to make sure you are putting the Unit Delay in the right place. It is possible that I have misunderstood the problem though.

Thanks for your answer. Though I haven't solved it, I learn much more from your comments.

Log in to comment.

Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!