Question: Problem 2: Write a function my_stat.m to compute statistics of a vector. The function should have the following header: function [stat] - my_stat (vect) where

 Problem 2: Write a function my_stat.m to compute statistics of a

Problem 2: Write a function my_stat.m to compute statistics of a vector. The function should have the following header: function [stat] - my_stat (vect) where the input vect is a 3-element row vector. The function produces the statistics in the output vector stat in the following manner: The first element of stat has the median value of vect. The second element of stat has the minimum value of vect. The third (last) element of stat has the maximum value of vect . If any two elements in vect are equal, then the two equal elements are listed first in stat . If all three elements in vect are equal, then stat is equal to vect. For example, for vect - [1 3 2], stat [2 1 3]. For vect [1 3 3], stat [3 3 1] Remember to give the function a description. You can use any type of if statements as well as the built-in functions: max, min, and median (a) Set p2a=evale('help my stat') (b) Set p2b-my stat([10.5 12.6 10.9]) (c) Set p2c-my stat ([130 313 420]) (d) Set p2d-my stat([12 12 9]) (e) Set p2e-my stat ([8 7 7]) (f) Set p2f-my stat([6 9 6 ]) (g) Set p2g-my.stat ([5 5 5]) Problem 2: Write a function my_stat.m to compute statistics of a vector. The function should have the following header: function [stat] - my_stat (vect) where the input vect is a 3-element row vector. The function produces the statistics in the output vector stat in the following manner: The first element of stat has the median value of vect. The second element of stat has the minimum value of vect. The third (last) element of stat has the maximum value of vect . If any two elements in vect are equal, then the two equal elements are listed first in stat . If all three elements in vect are equal, then stat is equal to vect. For example, for vect - [1 3 2], stat [2 1 3]. For vect [1 3 3], stat [3 3 1] Remember to give the function a description. You can use any type of if statements as well as the built-in functions: max, min, and median (a) Set p2a=evale('help my stat') (b) Set p2b-my stat([10.5 12.6 10.9]) (c) Set p2c-my stat ([130 313 420]) (d) Set p2d-my stat([12 12 9]) (e) Set p2e-my stat ([8 7 7]) (f) Set p2f-my stat([6 9 6 ]) (g) Set p2g-my.stat ([5 5 5])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!