Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
help in xor operation

Subject: help in xor operation

From: aralimaradsir@gmail.com

Date: 28 May, 2009 07:19:35

Message: 1 of 2

Hi ,i have following code in that i have to xor the end results to get
my required value can you tell me how can i do it thank you
clc;
format hex
% N=input('enter the number of iterations N');
% N1=input('enter the number of iterations N1');
% x=input('enter the initial value of x');
N=3000
N1=1400
f1=fopen('c:\bye.dat','w+');
h=zeros(1024,16);

for k=1:100
a = 0.197; % Lower bound
 b = 1; % Upper bound
 x1 = (b-a)*rand(1,1)+a
 Y1=0;

% x=0
Y=0;
x = (b-a)*rand(1,1)+a;
  for n=1:1:N
   x1=4.*x1.*(1-x1);
% x=sin(12.5/x);
x=cos(4* acos(x));
% x=1/x.*(mod (1,1))
      if n==N1-1
        Y1=x1;
    Y=x;
      end
  end
c=[Y,x];
c1 = mat2cell(sprintf('%bx',Y),1,[2, 2, 2, 2, 2, 2, 2, 2]);
c2 = mat2cell(sprintf('%bx',x),1,[2, 2, 2, 2, 2, 2, 2, 2]) ;
key_hex = cat(2,c1,c2)
key_hex=hex2dec(key_hex)
na1=dec2bin(key_hex)
c33=[Y1,x1];
c11 = mat2cell(sprintf('%bx',Y1),1,[2, 2, 2, 2, 2, 2, 2, 2]);
c22 = mat2cell(sprintf('%bx',x1),1,[2, 2, 2, 2, 2, 2, 2, 2]);
key_hex1 = cat(2,c11,c22)
key_hex1=hex2dec(key_hex1)
na=dec2bin(key_hex1)
r=xor(key_hex1,key_hex)
fprintf(f1,'%d\n',key_hex);
end
fclose(f1)

Subject: help in xor operation

From: us

Date: 28 May, 2009 07:39:02

Message: 2 of 2

aralimaradsir@gmail.com wrote in message <77033644-4231-4724-98b2-9b812dbc9ba2@x1g2000prh.googlegroups.com>...
> Hi ,i have following code in that i have to xor the end results to get
> my required value can you tell me how can i do it thank you
> clc;
> format hex
> % N=input('enter the number of iterations N');
> % N1=input('enter the number of iterations N1');
> % x=input('enter the initial value of x');
> N=3000
> N1=1400
> f1=fopen('c:\bye.dat','w+');
> h=zeros(1024,16);
>
> for k=1:100
> a = 0.197; % Lower bound
> b = 1; % Upper bound
> x1 = (b-a)*rand(1,1)+a
> Y1=0;
>
> % x=0
> Y=0;
> x = (b-a)*rand(1,1)+a;
> for n=1:1:N
> x1=4.*x1.*(1-x1);
> % x=sin(12.5/x);
> x=cos(4* acos(x));
> % x=1/x.*(mod (1,1))
> if n==N1-1
> Y1=x1;
> Y=x;
> end
> end
> c=[Y,x];
> c1 = mat2cell(sprintf('%bx',Y),1,[2, 2, 2, 2, 2, 2, 2, 2]);
> c2 = mat2cell(sprintf('%bx',x),1,[2, 2, 2, 2, 2, 2, 2, 2]) ;
> key_hex = cat(2,c1,c2)
> key_hex=hex2dec(key_hex)
> na1=dec2bin(key_hex)
> c33=[Y1,x1];
> c11 = mat2cell(sprintf('%bx',Y1),1,[2, 2, 2, 2, 2, 2, 2, 2]);
> c22 = mat2cell(sprintf('%bx',x1),1,[2, 2, 2, 2, 2, 2, 2, 2]);
> key_hex1 = cat(2,c11,c22)
> key_hex1=hex2dec(key_hex1)
> na=dec2bin(key_hex1)
> r=xor(key_hex1,key_hex)
> fprintf(f1,'%d\n',key_hex);
> end
> fclose(f1)

CSSMers are certainly not going to copy/paste those idiosyncratic lines of code, which, to boot, open a file that nobody has...
give a short and concise example of what you're input looks like and what output you expect - and - make it copy/paste-able...
this often solves (part of) the problem right away...

us

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us