Effacer les filtres
Effacer les filtres

XOR operation of double values?

5 vues (au cours des 30 derniers jours)
Sneha P S
Sneha P S le 23 Jan 2018
Commenté : Steven Lord le 13 Mar 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 commentaires
James Tursa
James Tursa le 23 Jan 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 le 24 Jan 2018
Modifié(e) : Walter Roberson le 24 Jan 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).

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 23 Jan 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 commentaires
Ikram Jumakulyyev
Ikram Jumakulyyev le 13 Mar 2020
It doesn't work
Steven Lord
Steven Lord le 13 Mar 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by