Question: Using MATLAB programming Write and test a function that computes the inner product of two vectors (1-dimensional arrays of numbers). The inner product is defined
Write and test a function that computes the inner product of two vectors (1-dimensional arrays of numbers). The inner product is defined to be That is, the inner product is the sum of the element-wise product of the two vectors x and y. For example, if x = [7 4 6] and y= [4 1 8], then the inner product x of and y is Your function should be able to handle input vectors of any size (both must be the same length). To test your function, write a script that calls the function with 2 vectors for which you have hand-calculated the inner product. Then, compare the result of the function to your hand calculation. If the output is correct (matches your hand calculation), then output a message indicating that the test passed). If the output is incorrect (does not match your hand calculation), then output a message indicating that the test failed. For bonus cool-points, also indicate what the inputs were, what the expected output was, and what the actual output was
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
