1. (5 points) Write and test a matlab function requiring iterationA sound engineer has recorded a sound signal from a…

A sound engineer has recorded a sound signal from a microphone.The sound signal was not recorded at all times, but rather is was sampled at certain discrete times.The units of each data sample are volts. Data samples below a certain threshold are not considered to be valid data values and will be ignored.Write an m-file script that will ask the user for the threshold, and then ask for the number of data samples to be entered, and then the actual data samples one at a time. Calculate and display the number of valid samples and the average of valid samples (if there are any valid samples). Here is an example run (user input is underlined):Enter the threshold: Enter the number of data samples: Please enter data sample 1: Please enter data sample 2: Please enter data sample 3: Please enter data sample 4: Please enter data sample 5: Please enter data sample 6: Please enter data sample 7: Valid data samples is 4The average is 5.53 volts.Create a test table and write an m-file script solve the problem. Design will be done in lecture or lab.Write a MATLAB m-file script that you can use to test MyRand(type, a, b) from Lab 8. To test a random function to see if it generates numbers of the correct distribution (Uniform, Exponential, Normal), generate a large number (like 10,000) of random numbers of each type, each into its own vector. Then plot 3 different histograms using the MATLAB function hist(x), which plots a histogram with 10 intervals for the elements in vector x. Also use the MATLAB function subplot(m,n,p) which will make all three histograms appear on the same screenSuppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what’s behind the doors, opens another door, say No. 3, which has a goat. He then says to you, ”Do you want to pick door No. 2?” Is it to your advantage to switch your choice? Write a matlab program to help you decide.HINT: Make a function to simulate one instance. Argument to function is a Boolean, does the player switch or not. Function returns a Boolean true of player wins, false if player loses. Call the function many times for each player strategy, and save the results to analyze and to determine the best player strategy

Posted in Uncategorized