question---->matlab code

Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2007
Posts: 9
Reputation: nemoo is an unknown quantity at this point 
Solved Threads: 0
nemoo nemoo is offline Offline
Newbie Poster

question---->matlab code

 
0
  #1
Dec 14th, 2008
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

so please help me
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum


Views: 735 | Replies: 0
Thread Tools Search this Thread



Tag cloud for Legacy and Other Languages
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC