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 

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

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 Programming Questions!