Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Matlab - please help!! This Mini Project involves the creation of a structure that will hold a dataset and statistical information about the data set.
Matlab - please help!!
This Mini Project involves the creation of a structure that will hold a dataset and statistical information about the data set. First, let's describe the properties of our stracture, Data. Data will have the following properties: values: an array of numbers in ascending order mean: the sample mean of all the numbers in value median: the sample median of all the numbers in value variance: the sample variance of all the numbers in value - - Note that you can use any variable name for Data in the follewing functions, but the properties described above MUST be spelled and capitalized EXACTLY as above in order for you to get the last part of this project running. In addition to this, the functions we ask you to write in this project must have EXACTLY the names we ask for in order for the last part of this project to work. The last part is not for a grade, but it is fun for you. Part I: Data Structure Creation Function Create a function named createData. createData should take one input: A number to start your data set of It should output a data structure, as defined above, values, mean, and median will all be your input number, variance will be 0, Part 2: Adding New Numbers Create a function called addData. addData should take two inputs in the following order A data structure A new number to add to that data structure It should output the data structure, with the new number included in the array contained by the values property. The number should be included in such a way that the array in values will always be sorted in ascending order. You can assume that the array is already in ascending order when the data 35 7 91. and your structure is given as an input. For example, if the array in values was [1 input number was 6, the new array would be [1 3 5 6 7 9 Part 3: Updating Statisties Note that you must accomplish hng in this part of the Mind Project without any bulr in functions that calewlate means, medians, standard deviations, or sums of arrays. There are qwite a few functions in MATLAB that do tasks like this. They are all forbidden here. You should focus on using mathematical inctions and operators that work on one or two indiidwal numbers, Joops, conditional statements, and array indexing Create a function called updateStats updateStats should take one input A data structure It should output a data structure with a newly calculated values for the mean, median, and variance propertics. Sce Appendix A for information on how to calculate these valucs. You can use the built-in MATLAB functions mean, median, and var to check your answers, but again, do not use them in the function Step 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