Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab : Unable to get unique rationals when implementing a formula for binary to real number conversion Part1

There is a nonlinear dynamic system x_n = f(x_n,eta) whose functional form is x[n+1] = 2*x[n] mod 1. This is a chaotic dynamical system called as the Sawtooth map or the Bernoulli Map. I am facing difficulty in implementing the two representations of the inverse mapping given by Eq(4) and Eq(5). Following is a brief description of the problem.

description

where the sequence (s[n+k])_k=1 to N-1 is the symbolic description of the state x[n]. This description arises from the partitioning of the unit interval described below.

Let, the number of partitions M = 2 and the symbol space = {0,1} and the rule for assigning symbols is

 s[n+1] = 1 if x[n] >= 0.5, otherwise s[n+1] = 0

Authors of this paper :

Linear, Random Representations of Chaos

For Eq(5) I am not getting the same time series after inverse, few values differ after doing the binary to real conversion. Can somebody please let me the correct procedure?

I tried to implement the Bijective map for the Eqs(4) and (5), but it does not work.

Code for Eq(5) - I am binarizing into 2 ways. x contains the real numbers; s is the 0/1 binary equivalent of each real; y is the answer after converting s to real. s1 is the +1/-1 binary equivalent of x; b is the answer after converting to real. In this case of +1/-1, when I am converting from symbolic representation to real, I switch -1 with 0 and then apply the formula in Eq(5). From the answers, it can be seen that y and b are not the same as x after doing the conversion. I am also getting negative reals for b when the original reals are all unsigned rationals!! How can I correctly implement so that they are both same?

N  =10;
x(1) = 0.1;
for i =1 : N
       x(i+1) = mod(x(i)*2, 1);
end
    y = x;
 s = (y>=0.5);  %generate 0/1 logicals


for n = 1: N        
y(n) = 0.5*s(n+1) + 0.5*y(n+1);   
end

b=x;

 s1 = 2*(b>=0.5)-1; %Generate +1/-1



    for k =1: N
   if s1(k)== -1
       s1(k) = 0;
   end
b(k) = 0.5*s1(k+1) + 0.5*b(k+1);   
 end

Let, x =

 0.100000000000000  0.200000000000000   0.400000000000000   0.800000000000000   0.600000000000000   0.200000000000000   0.400000000000000   0.800000000000001   0.600000000000001   0.200000000000003   0.400000000000006

y =

0.100000000000000   0.200000000000000   0.900000000000000   0.800000000000000   0.100000000000000   0.200000000000000   0.900000000000000   0.800000000000001   0.100000000000001   0.200000000000003   0.400000000000006

b =

-0.400000000000000  0.700000000000000   0.900000000000000   -0.200000000000000  -0.400000000000000  0.700000000000000   0.900000000000000   -0.199999999999999  -0.399999999999999  -0.299999999999997  0.400000000000006
like image 246
SKM Avatar asked Jun 01 '15 20:06

SKM


1 Answers

this piece of your code is completely wrong ,you change s(k) but you use s(k+1), it means that changing s(k) has not any effect!

 for k =1: N
    if s1(k)== -1
       s1(k) = 0;
    end
 b(k) = 0.5*s1(k+1) + 0.5*b(k+1);   
 end

true one is:

  for k =1: N+1
    if s1(k)== -1
       s1(k) = 0;
    end
  end
  for k =1: N
      b(k) = 0.5*s1(k+1) + 0.5*b(k+1);
  end

y =

Columns 1 through 10

0.1000    0.2000    0.9000    0.8000    0.1000    0.2000    0.9000    0.8000    0.1000    0.2000

Column 11

0.4000

b =

Columns 1 through 10

0.1000    0.2000    0.9000    0.8000    0.1000    0.2000    0.9000    0.8000    0.1000    0.2000

Column 11

0.4000

x= 0.1 0.2 0.4 0.8

1)b=x => b=0.1 0.2 0.4 0.8

2)s1= 2(b>=0.5)-1 =>s1= -1 -1 -1 1

3)loop on s1=> s1= 0 0 0 1

4)b(3)=0.5*s(4)+0.5(b4)=0.5+0.4=0.9

so code is correct, but your formula is in correct! and one another thing, >step 3 and 4 cancel out each other, i mean result of step 3 and 4 together is (b>0.5), and as a conclusion! its obvious from your formula that if x(i)>0.5 and x(i-1)<0.5 then b(i-1) cannot be equal to x(i-1)

because b(i-1)=0.5*X(i)+0.5*((x(i)>0.5))

and if we assume x(i)>0.5 we could write:

b(i-1)=0.5*X(i)+0.5*1

and we know x(i)=mod(2x(i-1),1)=2*x(i-1) {because x(i-1)<0.5 so 2*x(i-1)<1}

so we have

b(i-1)=0.5*2*X(i-1)+0.5*1=X(i-1)+0.5 => b(i-1)>0.5, but x(i-1)<0.5!!!!!

so your formula is wrong.

like image 117
Hadi Avatar answered Nov 15 '22 11:11

Hadi