问题
[Tent Map][1] is a dynamical system that is discrete in time. Iterations of the map yields a time series.
The entropy of this system when discretized in 0/1 using a threshold = 0.5 is, H = log_2(2) = 0.69 approx. I want to obtain a graph with Y Axis as the entropy and X Axis as the Number of samples or the length of the time series. I have written a code for obatining the entropy by varying the length of the time series. The objective is to see at what length of the discretized time series, I get the entropy H. The code however, loops infinitely and never reaches the entropy value H. Can somebody please help in obtaining the graph? Thank you.
[1]: https://en.wikipedia.org/wiki/Tent_map
回答1:
You are saying that lambda
must be EXACTLY equal to log(2)
. When the entropy drops below log(2)
it skips over this value (for instance instead of exactly log(2) maybe an iteration is 0.69309 which is less). Try replacing the line
while(lambda ~=H)
with
tol=0.01;
while(~(abs(lambda-H)<tol))
this will mean that it quits whenever lambda
is close to H
(with in the tolerance tol
).
If your tol
is too small (try 0.001) an iteration would jump over it again and you would be back to the problem you had before.
来源:https://stackoverflow.com/questions/37421738/matlab-plot-of-entropy-vs-digitized-code-length