Question: code with Matlab please Activities Today we (and by that I mean you are going to write a bunch of functions. The rules are: Code


Activities Today we (and by that I mean you are going to write a bunch of functions. The rules are: Code the solutions for each of the problems below in the file LabM3_Stats_fcns.m. Use the function names as specified below. Do not use the built-in equivalent of the function to implement a function (only use the built-in Matlab equivalent to test your code). For example, do not use the built-in sum function to implement your sum function; use the built-in sum function to generate an answer to compare with the result of your sum function Create a test routine named LabM3_fcns as the first function in the file. This function will execute each of the other functions to ensure that each works properly. Compare each result to the built-in equivalent (if such a function exists). Test each function as you create it. Remember, LabM3_Stats_fcns is the driver"; it does not implement the solutions. fprintf is not appropriate for printing the results of the functions that return multiple values. Do not use the built-in equivalent of the function to implement the function. Note that all functions have an argument that is a 2D array (a matrix). . Do not use the built-in equivalent of the function to implement the function. Each result is for the entirety of the elements. For example, your sum function returns the sum total (a scalar) of all the elements. Each result is returned by its respective function. It is not printed by the statistics function When finished, none of the statistics functions outputs anything to the screen. Do not use the built-in equivalent of the function to implement the function. . Do not print from within any of the statistics functions. The intent of this assignment is to increase your understanding and comfort level in using the flow control constructs for looping and branching. Therefore, use looping to step through (access) each of the elements of the input matrices while implementing each function (as discussed in class). The functions are as follows: Problem 1 (the_abs) Determine the absolute value of each value of the single input provided as a calling argument; use looping and branching. Return the array result. Problem 2 (the_sum) Determine the sum of the values of the single input provided as a calling argument; use looping. Return the scalar result. Problem 3 (the_mean) Determine the mean of the values of the single input provided as a calling argument. Make use of the routine that you have already written (above). Return the scalar result. Problem 4 (the_min) Determine the minimum of the values provided in the single input calling argument. Use looping and branching; don't use a sort. i.e. do NOT use a sort). Return the scalar result. Problem 5 (the_max) Determine the maximum (i.e., largest) of the values provided in the single input calling argument. Use looping and branching: you guessed it, NO sorting. Return the scalar result. Problem 6 (the_range) Determine the range of the values provided (i.e., largest minus the smallest) in the single input calling argument. Use functions you already completed above. Return the scalar result. Problem 7 (the_mad) Determine the mean absolute deviation (i.e., average of the absolute value of each point's difference from the overall mean) of the values provided in the single input calling argument. Use looping, Return the scalar result. Problem 8 (the_var) Determine the sample variance of the values provided in the single input calling argument. Assume the values represent a sample. Again, use looping. Return the scalar result. Problem 9 (the_std) Determine the sample standard deviation of the values provided in the single input calling argument. Assume the values represent a sample. Make use of the routine that you have already written (above). Use looping. Return the scalar result. Problem 10 (the_sort) Sort the values of the single input provided as a calling argument. Implement a bubble sort. Use looping and branching. Return the sorted values as the result. Problem 11 (the_median) Determine the median of the values of the single input provided as a calling argument. Make use of the routine that you have already written (i.e., the sort). Use branching. If you use looping, you have done something wrong. Return the scalar result. Problem 12 (the_mode) Determine all modes of the values provided in the single input calling argument; use looping, and branching (as needed). When all the elements appear only once, do as discussed in class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
