Computer Science (MATLAB)
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.
Respond to this Question
Similar Questions

Computer Science (MATLAB)
I had a test in my computer science course in which I was asked if any while loop can be replaced with a for loop. I put true. I guess the answer was false. My professor said that if you had a while loop in which you asked the 
Computer Science (MATLAB)
I had a test in my computer science course in which I was asked if any while loop can be replaced with a for loop. I put true. I guess the answer was false. My professor said that if you had a while loop in which you asked the 
bio statistics question!
Does P(x) = x/5, where x can take values of 0, 1, 2, 3, describe a probability distribution? Would the answer be no because when x is 1, 2, or 3 the values become 0.2, 0.4, and 0.6. But in probability distribution the values have 
Computer Science  MATLAB
One interesting property of a Fibonacci sequence is that the ratio of the values of adjacent members of the sequence approach a number called “the golden ratio” or PHI. Create a program that accepts the first two numbers of a 
Computer Science  MATLAB
I guess it was skipped One interesting property of a Fibonacci sequence is that the ratio of the values of adjacent members of the sequence approach a number called “the golden ratio” or PHI. Create a program that accepts the 
Computer Science (MATLAB)
Given an arbitrary one dimensional vector v imputed by the user for example v='Helllllloooooo' or v='Helo' I was able to append empty characters onto any one dimensional vector that the user can enter so that way the total length 
Statistics and Probability
Commuters were asked how many times a week they stop for coffee on their way to work. A survey found a mean of 3 times a week with a standard deviation of 0.55. Find the probability that the sum of 100 values is more than 290. 
Math
For what values of k will the functon f(x)=kx^24x+k have no zeros Determine the values of k for which the function f(x)=4x^23x+2kx+1 have 2 zeros 
C++
// Program: name of program // Author: your name // Date Written: date you began writing the program /* Abstract: Brief description of the program */ Include inline comments in the body of your program. You can convert 
computer science
Create a program that uses the preceding formula and displays the result, but this time, prompt the user for the values a, b, x, and y. Use appropriate variable names and naming conventions.