Question: in matlab: 1 . a ) Create a subfunction named arbitrary _ math that has one input and one output. The function should expect the

in matlab: 1. a) Create a subfunction named arbitrary_math that has one input and one output. The
function should expect the input to be a 2x2 array of integers. If the first row contains one odd
and one even number, the function should return the arithmetic mean of the elements in the
second row as its output. If the first row contains either two odd or two even numbers, it should
return the geometric mean of the elements in the second row as its output.
b) Write the line n =4; at the top of a new section of code. Write code that will create a 1xn
empty cell array named Data. Use for loops and if statements to fill in Data with 2x2 arrays
that read as the Fibonacci sequence when read in Matlab reading order (the first cell should
contain [1,2;1;3], the second [5,13;8,21], etc.). Create a 1xn array of zeros named
Processed_Data
c) Use a for loop to run the arbitrary_math function on every cell of Data and assign the
outputs to Processed_Data. Once all calculations have been made, display the nth cell of
Data and the entirety of Processed_Data in the command window (only display them once,
at the end). Change the value of n at the top of your code to 6 and run it again. Your submission
need only include the output for n =6

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!