XOR operation of double values?

4 次查看(过去 30 天)
Sneha P S
Sneha P S 2018-1-23
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 个评论
James Tursa
James Tursa 2018-1-23
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 2018-1-24
编辑:Walter Roberson 2018-1-24
%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).

请先登录,再进行评论。

回答(1 个)

Jan
Jan 2018-1-23
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 个评论
Steven Lord
Steven Lord 2020-3-13
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by