# Algebraic state in algebraic loop

4 views (last 30 days)
Meddour Aissam riad on 15 Jul 2020
Answered: maiaL on 16 Jul 2020
Hi there, i hope you're doing fine!
i simplified my problem in order to get a fast answer.
My complicated simulink model dosen't work fo the same problem as this simplified example ( because of the derivative bloc).
is there ani tricks to make it work and to make the derivative block ignore the fact that it don't have the first point of the first itteration.
Thanks a lot for your help
John D'Errico on 16 Jul 2020
Edited: John D'Errico on 16 Jul 2020
Even though you are desperate to get a fast answer, posting the same question after a half day won't help either. I closed the duplicate question.
That you are desperate is clear. However, you also need to accept that a significant fraction of people using MATLAB have absolutely no knowledge of Simulink. For example, I don't use it & don't have it.
That means you need for someone to read your question who has the knowledge to answer it and the willingness and time to do so. This seems to be a moderately simple question, and you have done a decent job of encapsulating the problem in a simple model. Even someone like me who has no knowledge of Simulink, can at least understand the issue you seem to have.
Finally, I would point out that you posted your duplicate question (then then bumped up this question at the same time) at roughly 4am Eastern time in the US. Many people who might choose to answer your question will be asleep in the US now.
Someone will wander in and eventually answer your question. I'm sorry that I cannot help you. But that is the way a public forum must work, as we are all just volunteers who answer when we can,, when we are able to do so.
Walter Roberson on 16 Jul 2020
I do not understand the question.
"is there ani tricks to make it work and to make the derivative block ignore the fact that it don't have the first point of the first itteration."
No, that model has an algebraic loop. It expresses
sin(t) / diff(f(t),t) == diff(f(t),t)
which is
sin(t) == diff(f(t),t)^2
which has solutions
C1 - 2*ellipticE(t/2 - pi/4, 2)
C2 + 2*ellipticE(t/2 - pi/4, 2)
At t = 0 that gives you
C1 + 2*ellipticE(pi/4, 2)
C2 - 2*ellipticE(pi/4, 2)
however, no initial conditions were specified for your model.
If you say that the initial conditions are 0 then f(t) is
- 2*ellipticE(pi/4, 2) - 2*ellipticE(t/2 - pi/4, 2)
2*ellipticE(pi/4, 2) + 2*ellipticE(t/2 - pi/4, 2)
... at least it has a solution in theory. But the solution goes imaginary after t = pi.

maiaL on 16 Jul 2020
You could try adding a Delay block before the input to the derivative block.
I don't know if the signal in your actual model is also sinewave-like, but the derivative will be zero on every half-period, so that's another problem on top of the algebraic loop.

### Categories

Find more on Programming in Help Center and File Exchange

R2019b

### Community Treasure Hunt

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

Start Hunting!