Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. You have to perform a calculation on a series of values from an experiment. The experi- ment was conducted 100 times and each outcome
1. You have to perform a calculation on a series of values from an experiment. The experi- ment was conducted 100 times and each outcome produced 201 values. The experiment data file is on Blackboard, as xdata.mat. The data is an array of doubles with 100 rows and 201 columns. Thus each row represents the 201 values produced from an experiment. The calculation you have to perform on each value is: sin (25%) + 0.2cos (4=*), if I 5 10 f() = -1, otherwise (a) (30 points) Create a function with one one inputs and two outputs, where the input is a numeric array. The first output should be a numeric array the same size as the input array whose value is the result of applying the calculation above to the input array. The second output should be the average (mean) of each row of the input array if it two dimensional or just the average if it is a vector. (b) (10 points) Call your function for the data given in xdata.mat. (c) (20 points) Find the experiment whose calculation had the largest and the smallest mean. Plot these two experiments on the same axis. The independent axis should be the proper row from xdata and the dependent value should be the calculation output on that row. 2. (40 points) Write a function in Matlab that replaces all instances of a given number with a different given number for an unknown sized array. The inputs to your function will be the unknown sized array, the number to be replaced and the number to replace it with. Your function should have two outputs, the number of replacements made, and the data array with the replacements made. Evaluate your function with the three inputs available on Blackboard within the data file prob2inputs. For input1 find all the 8s and replace them with Os. For input2 find all the 37s and replace them with 2. For input3 find all the 13s and replace them with -100
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