Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Answer parts a and b. DO NOT USE while or for loops, reshape, randperm or fprintf. ONLY USE if statements, vectors, matrices, functions, or sprintf.
Answer parts a and b. DO NOT USE while or for loops, reshape, randperm or fprintf. ONLY USE if statements, vectors, matrices, functions, or sprintf.
(Coin flip) In this problem, you will flip a coin by producing a single random integer of value 0 or 1 using randi and if it is 0, then the coin is heads and if it is 1. then it is "tails. flip_coin Function: Input variables: none Output variables: a string of either heads or tails depending on the random number gen- erated A possible sample case is: >> [coin_string] flip_coin() coin_string = heads (Median) The median of a list of numbers is easy to find if the list is sorted. In particular, if it is sorted, then, if the list has an odd number of entries, it is simply the entry in the middle place, but if the list has an even number of entries, it is the average of the two middle-most entries. find_median_of_sorted Function: Input variables: a vector of numbers in sorted order Output variables: a scalar representing the median of the numbers in the input vector A possible sample case is: >> median = find_median_of_sorted ([1 2 3 4]) median = 2.5000Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started