nemoo 0 Newbie Poster

hello :)

i'm trying to creat a code to evalute this equation as a function of u

eq=(u)(u+1)(u+2).........(u+s-1) ,where s is a given value
an after so calculates the integral of this function from 0 to 1

this is the code i wrote but i got an error

%in prod2.m file
function m=prod2(u)
s=5;
m=prod(u:u+s-1);
%in test.m file
Q=quad(@prod2,0,1)

and this is the error i got

??? Index exceeds matrix dimensions.

Error in ==> C:\MATLAB6p5\toolbox\matlab\funfun\quad.m
On line 68 ==> if ~isfinite(y(7))

Error in ==> C:\MATLAB6p5\work\test.m
On line 2 ==> Q=quad(@prod2,0,1)

although when i tried to call the prod2 function in the command window it worked :S

so please help me :(