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/Fcn8' 'mysimulink1/Sign2' (discontinuity) 'mysimulink1/Fcn7' 'mysimulink1/Sign1' (discontinuity) 'mysimulink1/Fcn5' 'mysimulink1/Product1' 'mysimulink1/Fcn6' 'mysimulink1/Sign' (discontinuity) 'mysimulink1/Fcn4' 'mysimulink1/Product' '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...

*No products are associated with this question.*

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

zhang xinghui
on 4 May 2012

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

K E
on 4 May 2012

zhang xinghui
on 5 May 2012

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

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

Learn moreOpportunities for recent engineering grads.

Apply Today
## 2 Comments

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/37380#comment_77414

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.

## zhang xinghui (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/37380#comment_77421

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