Posted by **Jhon** on Tuesday, October 18, 2011 at 9:53am.

Given a vector of values of zeros and ones such as [1 0 1 0 0 0 1 0] I'm asked to, given a probability provided by the user, use that probability to change the values in the vector using that probability.

For example given the vector [0 1 0 0 0 1 0 0 0 1] and probability .2 provided by the user there is a 20% chance that the values in the vector will change (either from 0 to 1 or 1 to 0) or that there's a good chance that a vector of 10 values 2 values in that vector will change.

I'm asked to create a function to do this and kind of confused how to do this with the probability of changing the values (apparently I have to use rand function which I know how to use just kind of lost how to do this)

I assume that I would have to take each value within the vector (there will be exactly 8 values in the vector) and doing something to each of these values with the probability and changing them from the current value to the one it is not (either 1 or 0).

I'm kind of lost. Thanks for any help which you can provide.

## Answer This Question

## Related Questions

- probability - out of 250 students interviewed at a community college, 90 were ...
- Computer Science (MATLAB) - I had a test in my computer science course in which ...
- Computer Science (MATLAB) - I had a test in my computer science course in which ...
- calculus - Find a unit vector U such that the rate of change of f in the ...
- Math (Probability) - It is known that steroids give users an advantage in ...
- Math - A large company has a private computer network connecting 300 different ...
- Probability - A binary communication system is used to send one of two messages...
- Computer Science (MATLAB) - Given an arbitrary one dimensional vector v imputed ...
- Probability - The newest invention of the 6.041x staff is a three-sided die. On...
- Applied Maths - Given that position vector a=4i+2j, position vector b=13i+5j are...

More Related Questions