how to generate samples uisng pseudo random generator

how to generate xor samples using pseudo random number generator

댓글 수: 2

doc rand % and friends for the RNGs in Matlab
what, and how, xor comes into play is totally unclear from what little was provided.
XOR input samples were generated by using a threshold function for 1000 values from a uniformly distributed pseudorandom number generator. The threshold function had a threshold level of 0.5. Sample = ( 1 ; value > 0:5 0 ; value >= 0:5

댓글을 달려면 로그인하십시오.

 채택된 답변

Star Strider
Star Strider 2014년 8월 27일
I am not certain that I understand what you want to do, but I will make an attempt at answering:
nrows = 5;
s = logical(randi(2, nrows, 2)-1);
out = xor(s(:,1),s(:,2));

댓글 수: 4

XOR input samples were generated by using a threshold function for 1000 values from a uniformly distributed pseudorandom number generator. The threshold function had a threshold level of 0.5. Sample = ( 1 ; value > 0:5 0 ; value >= 0:5
If you need a uniform continuous vector of 1000 samples:
rv = rand(1000,1); % Column vector
This doesn’t make sense, though:
( 1 ; value > 0:5 0 ; value >= 0:5
You probably mean:
rn = [0*(rv <= 0.5) + 1*(rv > 0.5)]; % rv converted to (0,1)
value is 1 when sample value greater than 0.5 and 0 when it is less than or equal to 0.5
That is exactly what ‘rn’ does. (The original continuous vector is ‘rv’.)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

카테고리

도움말 센터File Exchange에서 Random Number Generation에 대해 자세히 알아보기

질문:

2014년 8월 27일

댓글:

2014년 8월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by