Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using MATLAB: Create a function called makemat that will receive two row vectors

ID: 3680339 • Letter: U

Question

Using MATLAB: Create a function called makemat that will receive two row vectors as input arguments. From These two row vectors makemat will create and return a matrix with two rows, where each row corresponds to the first and second argument, respectively. You may not assume that the length of the argument vectors is known. Also, the vectors may be of different lengths. If this is the case then first add 0s to end of the shorter vector in order to make it as long as the other argument Question 1 15 marks Create a function called makemat that will receive two row vectors as input arguments. From these two row vectors makemat will create and return a matrix with two rows, where each row corresponds to the first and second argument, respectively. You may not assume that the length of the argument vectors is known. Also, the vectors may be of different lengths. If this is the case then first add 0s to end of the shorter vector in order to make it as long as the other argument.

Explanation / Answer

makemat((j,k)->j+k,4,3)

or first define the h function:

h(j,k):=j+k

then, input:

makemat(h,4,3)

Output :

[[0,1,2],[1,2,3],[2,3,4],[3,4,5]]

Note that the indices are counted starting from 0.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote