Question: 4. Construction of user-defined functions (numerical solvers) Write a user-defined function FunTest1 with input variables A and k and output variable y. The variable A

4. Construction of user-defined functions (numerical solvers) Write a user-defined function FunTest1 with input variables A and k and output variable y. The variable A is a two-dimensional data array (matrix). The function will first divide, element by element, the k-th row of Aby the (k+2)-th row of A. The function will then sum all the elements of the resulting vector and return this value to the output variable y. Note that an error message should be displayed if k+2 is larger than the number of rows of A. Note: You may use the partially completed m-file FunTest1.m provided. Copy and paste the completed m-file below. Remember to remove part" from file name before execution. a) Benchmark testing is an important tool learned in BE 1500. Benchmark test your function on A=ones (20,50) and k=13. The expected answer for the output is y=50. b) Apply your function to a 8 x 6 matrix A constructed by multiplying a column vector [1:8].' to a row vector of [1:6), and k=5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
