Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Matlab! Given a set of m sorted random variables: I = {21, ..., Im}, its median Med(2) is the middle number. Med (2) I(m+1)/2,
Using Matlab!
Given a set of m sorted random variables: I = {21, ..., Im}, its median Med(2) is the middle number. Med (2) I(m+1)/2, Im/2+1(m/2)+1 if m is odd if m is even (1) The median of a finite list of numbers can be computed by built-in MATLAB function median. For example: A = [1 3 2 5 7 2 10 pi]; median (A) 1 2 ans 3 a) Write a function named myMedian that replicate this behaviour. It should take an input vector x, and then compute and output its median according to Eq. (1). b) Program validation. Verify your function on two examples of your choice (e.g., using randn(1,m) to generate m random numbers). Compare your result to the result of the corresponding built-in MATLAB functionStep 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