Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

image text in transcribed

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.5000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the y-coordinate of all points in the xz-plane?

Answered: 1 week ago