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 ...
- calculus - Find a unit vector U such that the rate of change of f in the ...
- 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 Please Help - Given the numerical values shown for the function f(x), ...
- bio statistics question! - Does P(x) = x/5, where x can take values of 0, 1, 2, ...
- Computer Science - MATLAB - One interesting property of a Fibonacci sequence is ...
- Computer Science - MATLAB - I guess it was skipped One interesting property of a...
- Probability - The newest invention of the 6.041x staff is a three-sided die. On...
- Computer science - A. Given a = 5, b = 1, x = 10, and y = 5, create a program ...

More Related Questions