Question: Write a MATLAB function say mydot that computes the dot product of two given vectors, a and b such that, b= ab. Note that
Write a MATLAB function say mydot that computes the dot product of two given vectors, a and b such that, b= ab. Note that in your function, you are not allowed to use MATLAB's built- in dot function! You are also required to return an error message by using disp or fprintf if the lengths of a and b are not same. Please test your function with: (a) A = [1, 3, 5] and B = [-3, -2], (b) A = [1, 3, 5] and B = [-3, -2, 4], (c) A = [0,-1,-4, -8] and B = [4, -2, -3,24].
Step by Step Solution
3.34 Rating (145 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
