trying to make a random number sequence similar to an MLS sequence

3 vues (au cours des 30 derniers jours)
Tom
Tom le 3 Avr 2012
I'm trying to create a random number sequence like this one: -
x = 2*rand(N,1)-1; % generate input noise signal
except instead of the numbers being at all different values between -1 and 1, I'd like them to be either -1 or 1 only.
Does anyone know how I might do this?
  2 commentaires
Daniel Shub
Daniel Shub le 4 Avr 2012
This is nothing like an MLS sequence. What you are looking for is often called Bernoulli noise.
Matt Fig
Matt Fig le 2 Nov 2012
Tom's question
I'm trying to create a random number sequence like this one: -
x = 2*rand(N,1)-1; % generate input noise signal
except instead of the numbers being at all different values between -1 and 1, I'd like them to be either -1 or 1 only.
Does anyone know how I might do this?

Connectez-vous pour commenter.

Réponse acceptée

Honglei Chen
Honglei Chen le 3 Avr 2012
a = 2*(randi(2,N,1)-1.5)
or
a = 2*(rand(N,1)>0.5)-1

Plus de réponses (0)

Catégories

En savoir plus sur Measurements and Spatial Audio dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by