Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Integration with variable limits
Replies: 17   Last Post: Aug 20, 2013 10:20 AM

 Messages: [ Previous | Next ]
 Sanaa Posts: 171 Registered: 3/20/12
Re: Integration with variable limits
Posted: Jul 30, 2013 5:33 PM

"Torsten" wrote in message <kst5mn$h75$1@newscl01ah.mathworks.com>...
> "Sanaa" wrote in message <kss3h5$50n$1@newscl01ah.mathworks.com>...
> > "Torsten" wrote in message <ksrcel$2k$1@newscl01ah.mathworks.com>...
> > > "Sanaa" wrote in message <ksrbia$r0l$1@newscl01ah.mathworks.com>...
> > > > Hi all,
> > > > How to integrate a function within a loop and the limits of integration are variables?
> > > > For instance, y(i)*(1-y(i)) is the function I wish to integrate from 0.25*i to t where
> > > > t \in (0.25*i, 0.25*(i+1)).
> > > > Any help is really appreciated.
> > > > Sanaa Moussa

> > >
> > > I think y(i)*(1-y(i)) is just a real number, not a function, isn't it ?
> > >
> > > Best wishes
> > > Torsten.

> >
> > Thanks for replying. You are right, but I mean the function is y*(1-y) which I want to put it into a loop
> > My code is
> > itermax=300;min=itermax-9;% That is we plot from 291:300 i.e. 10 values of x only.
> > r=0.25;
> > for rho=0:0.001:4
> > %x0=0.1;
> > x(1)=0.1;
> > for i=1:itermax-1
> > %t=linspace(i*r,(i+1)*r,itermax)
> > y(i+1)=x(i);
> > x(i+1)=x(i)+ rho*int(y(i)*(1-y(i)),i*r,(i+1)*r);
> > end
> > %fix(y)
> > plot(rho*ones(10),x(min:itermax),'b.','linewidth',0.1)
> > hold on
> > end
> > fsize=15;
> > xlabel('\rho','FontSize',fsize)
> > ylabel('\itx','FontSize',fsize)
> > %title('r=0.25, \alpha=1','FontSize',fsize)
> > hold off
> > % print(gcf, '-djpeg', '-zbuffer', 'bif.png');
> >
> > I get the error
> > Function 'int' is not defined for values of class 'double'.
> > what does this mean and how to fix it please?
> > Many thanks in advance.

>
> It means what I said before:
> y(i)*(1-y(i))
> is a scalar value and not a function.
> So "int" does not know how to handle this because it expects a function, not a scalar as its first input argument.
>
> Best wishes
> Torsten.

Sorry for not posing my question correctly. The function I want to integrate is
y(s)*(1-y(s)) ds from (n*0.25) to t, and t/in(n*0.25, (n+1)*0.25).
Do you have any idea on how to format my code above to solve my problem?

Date Subject Author
7/25/13 Sanaa
7/25/13 Torsten
7/25/13 Sanaa
7/26/13 Torsten
7/30/13 Sanaa
7/31/13 Torsten
7/31/13 Torsten
7/31/13 Steven Lord
8/15/13 Sanaa
8/15/13 Torsten
8/15/13 Sanaa
8/15/13 Torsten
8/16/13 Sanaa
8/16/13 Torsten
8/16/13 Sanaa
8/16/13 Torsten
8/16/13 Sanaa
8/20/13 Torsten