Borrar filtros
Borrar filtros

XOR operation of double values?

4 visualizaciones (últimos 30 días)
Sneha P S
Sneha P S el 23 de En. de 2018
Comentada: Steven Lord el 13 de Mzo. de 2020
I have a chaotic sequence of 65536 values in sy and the binary equivalent is stored in sybin as type double. Sybin has 65536 binary values as a column matrix and i need to xor some integer values in the following steps with sybin(i) where i=1,2,3,... So i convert those integer values to binary. But i couldnot xor it because i cant access the 8 bits from sybin (sybin(1)) comletely. Please help me with this.
  2 comentarios
James Tursa
James Tursa el 23 de En. de 2018
Pleas provide a short example of your problem, not just a worded description. Show the values of a few samples, tell us the exact class and size of the variables, show us the current code you are using, and tell us what seems to be going wrong and what the desired output should be.
Sneha P S
Sneha P S el 24 de En. de 2018
Editada: Walter Roberson el 24 de En. de 2018
%Tent Map
u = 1.99;
N = 65536;
x = linspace(0,1,N); % create a vector of x-positions
for i=1:N
if x(i) < 0.5
y(i)=u*x(i);
elseif x(i) >= 0.5
y(i)=u*(1-x(i));
end
sy(i) = mod(round(y(i) * 10^10),256);
end
sybin = (dec2bin(sy)) - '0';
This is what is in sybin.
similarly two more sequences sbbin and sdbin.
three of these as 65536*8 double.
now i need to implement the below equations.
How could i get the values s1(i).

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 23 de En. de 2018
James' comment is very useful. Currently answering requires too much guessing to be efficient. But I try it:
xor works on variables of type double directly. There is no need to convert them to char vectors (also called "binary", but this is a weak interpretation). Try this:
a = randi([0, 255], 1, 10)
xor(a, 17)
  2 comentarios
Ikram Jumakulyyev
Ikram Jumakulyyev el 13 de Mzo. de 2020
It doesn't work
Steven Lord
Steven Lord el 13 de Mzo. de 2020
Define "doesn't work".
Does your code throw an error? If so show us your code (and a brief description of what your code does if it's not obvious) and the full and exact text of the error message you recieved (all the text displayed in red.)
Does your code issue warnings? If so do as in the error case but show the text of the warning message(s) displayed in orange.
Does your code give different answers than you expect? If so, show us your code and explanation, explain what answers you expected the code to give, and show what answers it actually gave.
If you meant something else, please give more details.

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by