Integration on a circular set in simulink

조회 수: 3(최근 30일)
Pascal 2015년 6월 5일
답변: Pascal 2015년 10월 7일
Hello, I would like to know if this is possible to obtain the same output as in the image below without having a diverging signal.
For instance, given a frequency of rotation (in rad/s), how to obtain the angle (in rad) in [-pi; pi[ without having a diverging signal?

채택된 답변

Pascal 2015년 10월 7일
I was glad to discover by chance that this problem is solved by integrator wrapping in MATLAB Simulink 2015b (maybe in 2015a, but almost certainly not in 2014b). See for details:, paragraph "wrapping cyclic states".
I did not know if this question caused the development of this function but this is exactly the feature I desired (the exemple of trigonometric computations is even proposed). My thanks to MathWorks!

추가 답변(1개)

Drew Davis
Drew Davis 2015년 6월 8일
If you have a signal that is > 0 for all time entering in the inport of the model, as time approaches infinity the signal downstream of the integrator will approach infinity. The way to work around this for oscillatory signals is to create a sort of "wrap from -pi to pi" set of blocks or subsystem that performs this function as you have in your example.
You can add a saturation to the output signal of the integrator but it does not sound like that is what you are trying to do.
  댓글 수: 1
Pascal 2015년 6월 9일
Your first proposition is exactly what I use. This improves the solution of the system (there is no "solver error" any more, in the range I use). This is due to the fact that sin(k*2*pi) is not 0 and increases as k increases, whereas sin(mod(k*2*pi), 2*pi) seems to be 0 for all the range of values I use.
Your second proposition however is not what I want to do.
I would like to have a block which has the output of the above sub system but without the possibly diverging system.
I tried resetting the integrator to its output +/-2*pi when it reached -pi/+pi, but this creates an algebraic loop which is difficult to solve.

댓글을 달려면 로그인하십시오.



Community Treasure Hunt

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

Start Hunting!

Translated by