Question: Task 1: New Matrices Write a function called makemat that will receive two column vectors as input arguments, and from them create and return a

 Task 1: New Matrices Write a function called makemat that will

Task 1: New Matrices Write a function called makemat that will receive two column vectors as input arguments, and from them create and return a matrix with two columns (n x 2). If either of both of the vectors passed in are row vectors, transpose them into column vectors. If either input is a matrix, your program should throw a unique error (Create your own error message). You may not assume that the length of the vectors is known. Also, the vectors may be of two different lengths. If that is the case, add O's to the end of one vector first to make it as long as the other (This is often referred to as padding the matrix with Os - do not use any built-in functions such as padarray(). Some examples of calling the function and the result you should see: >> makemat ([1;2;3;4], [5; 6; 7;8]) ans = 1 1 2 3 4 5 6 7 8 >> makemat([1,3,5], [2,4,6,8]) ans = 1 2 34 5 6 >> makemat ([1,2;3,4],[5,6,7]) Error using makemat (line 6) Can't process a matrix, try again. Undefined for matrix input arguments Figure 1: Some examples of calling the makemat function Task 2: Sum Matrices Write a function called sumMatrix that will receive the matrix generated in Task 1 and add all the values in the matrix and returns that value. You need to index appropriately and use loops to achieve this

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!