-2

I do not have the communications toolbox and do not want to pay for it so i can't use the randsrc function. The probability for the occurrence of a 0 should be 0.2 and the occurrence of a 1 thus 0.8.

x = rand(1 100)
Adriaan
  • 17,741
  • 7
  • 42
  • 75

1 Answers1

2
A = rand(1,100); % uniform distributed between 0 and 1
B = A>=0.2; % Makes the lowest 20% values 0, the rest 1
Adriaan
  • 17,741
  • 7
  • 42
  • 75