Write a function max_product that takes v a vector and n, a positive integer, as inputs and computes the largest product of n consecutive elements of v

Epidemiology Paper Part Two
September 19, 2020
The Case Of The Man With The Weak Arm
September 19, 2020

Write a function max_product that takes v a vector and n, a positive integer, as inputs and computes the largest product of n consecutive elements of v

Write a function max_product that takes v a vector and n, a positive integer, as inputs and computes the largest product of n consecutive elements of v. It returns the product and the index of the element of v that is the first term of the product. If there are multiple such products in v, the function must return the one with the smallest starting index. As an example, the following call
>> [product, ind] = max_product([1 2 2 1 3 1],3);
will assign 6 to product and 3 to ind since the max 3-term product in the input vector is 2*1*3. If v has fewer than n elements, the function returns 0 and -1, respectively.


 

PLACE THIS ORDER OR A SIMILAR ORDER WITH MY ONLINE PROFESSOR TODAY AND GET AN AMAZING DISCOUNT

get-your-custom-paper

The post Write a function max_product that takes v a vector and n, a positive integer, as inputs and computes the largest product of n consecutive elements of v appeared first on MY ONLINE PROFESSOR .

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.