Question: In this exercise, you will write a function with inputs and outputs that can be vectors and matrices. Write a Matlab function named test _

In this exercise, you will write a function with inputs and outputs that can be vectors and matrices.
Write a Matlab function named test_function that has two input arguments and three output arguments.
The first input argument is a vector, either a row or column vector. The second input argument is a matrix with the same number of elements as the first input vector argument.
The first output argument must hold result of the element-wise operation i*xi, where xi is the i-th element of the first input vector.
The second output argument must hold the vector of element-wise products between the elements of the vector and matrix inputs. The elements of the matrix are considered in row-wise
order; the elements on the first row, then the elements on the second row, and so forth.
The third output argument is a vector of all zeros of the same length as the first input vector argument, except the first element that hold the maximum of all values in the second input matrix
argument. Moreover, the output should be a row vector when the input vector is a column vector; and, similarly, when the input is a row vector, the output should be a column vector.
In this exercise, you will write a function with inputs and outputs that can be vectors and matrices.
Write a Matlab function named test_function that has two input arguments and three output arguments.
The first input argument is a vector, either a row or column vector. The second input argument is a matrix with the same number of elements as the first input vector argument.
The first output argument must hold result of the element-wise operation i*xi, where xi is the i-th element of the first input vector.
The second output argument must hold the vector of element-wise products between the elements of the vector and matrix inputs. The elements of the matrix are considered in row-wise
order; the elements on the first row, then the elements on the second row, and so forth.
The third output argument is a vector of all zeros of the same length as the first input vector argument, except the first element that hold the maximum of all values in the second input matrix
argument. Moreover, the output should be a row vector when the input vector is a column vector; and, similarly, when the input is a row vector, the output should be a column vector
PROBLEM:
I keep getting an error that says the output isn't correct for a random row and/or column vector input. Or that the size of variable c must be [13] but is [31]
In this exercise, you will write a function with

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 Programming Questions!