XOR operation of double values?

조회 수: 9 (최근 30일)
Sneha P S
Sneha P S 2018년 1월 23일
댓글: Steven Lord 2020년 3월 13일
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
Ikram Jumakulyyev
Ikram Jumakulyyev 2020년 3월 13일
It doesn't work
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에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by