Just a simple matlab question, very basic. However I am useless at matlab so just need the work done as soon as possible. Shouldn't take an expert more then 5-10 minutes.
Write a MATLAB function which computes the cumulative product of the elements
in a vector. The cumulative product of the jth element of the vector x, xj,
is defined by
pj = (x1)(x2) ... (xj)
for j = 1:length of the vector x. Create 2 different versions of this
function.
a. One that uses two for-loops to explicitly carry out the calculations,
element by element. An "inner" loop should accumulate the product and an
"outer" loop should move through the elements of the vector p.
b. One that uses the built-in function prod to replace the inner loop.
## Deliverables
Please do this question for me before the end of the week
Write a MATLAB function which computes the cumulative product of the elements
in a vector. The cumulative product of the jth element of the vector x, xj,
is defined by
pj = (x1)(x2) ... (xj)
for j = 1:length of the vector x. Create 2 different versions of this
function.
a. One that uses two for-loops to explicitly carry out the calculations,
element by element. An "inner" loop should accumulate the product and an
"outer" loop should move through the elements of the vector p.
b. One that uses the built-in function prod to replace the inner loop.