Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
solving for the upper limit in an integral !

Subject: solving for the upper limit in an integral !

From: aravind bhimarasetty

Date: 13 Oct, 2007 09:27:21

Message: 1 of 9

Hi,

Given that,
y = k1*x*sin(k2*x - w*t)
and
 integral(x=0 to x0){sqrt(1+ (dy/dx)^2)} dx = L

Now, I already have the numerical values of k1, k2, w, L. I
want to find out x0 that satisfies the above integral equation.
I dont need a closed form solution; a plot of x0 vs t(time)
is sufficient.

Please help me crack this problem...thank you

Subject: solving for the upper limit in an integral !

From: Per Sundqvist

Date: 13 Oct, 2007 19:23:48

Message: 2 of 9

"aravind bhimarasetty" <baravi.no.spam@mathworks.com> wrote
in message <feq31p$ot4$1@fred.mathworks.com>...
> Hi,
>
> Given that,
> y = k1*x*sin(k2*x - w*t)
> and
> integral(x=0 to x0){sqrt(1+ (dy/dx)^2)} dx = L
>
> Now, I already have the numerical values of k1, k2, w, L. I
> want to find out x0 that satisfies the above integral
equation.
> I dont need a closed form solution; a plot of x0 vs t(time)
> is sufficient.
>
> Please help me crack this problem...thank you

Regardless the integrand you could use cumtrapz and interp1

xmax=10; %some large value
x=linspace(0,xmax,1000);
f=sin(x);%change here

x0=interp1(cumtrapz(x,f),x,L,'linear')

Hope it helps,
Per

Subject: solving for the upper limit in an integral !

From: carlos lopez

Date: 14 Oct, 2007 01:32:36

Message: 3 of 9

"aravind bhimarasetty" <baravi.no.spam@mathworks.com> wrote
in message <feq31p$ot4$1@fred.mathworks.com>...
> Hi,
>
> Given that,
> y = k1*x*sin(k2*x - w*t)
> and
> integral(x=0 to x0){sqrt(1+ (dy/dx)^2)} dx = L
>
> Now, I already have the numerical values of k1, k2, w, L. I
> want to find out x0 that satisfies the above integral
equation.
This can be rephrased as an ODE
dLenght/dx={sqrt(1+ (dy/dx)^2)} dx
with initial value Length=0 for x=0
You might run any ode solver taking into consideration the
event " Length(x0)=L" as the end of the calculations. Look
for 'Events' property of the OPTIONS valid for ode45
Regards
Carlos

Subject: solving for the upper limit in an integral !

From: aravind bhimarasetty

Date: 15 Oct, 2007 06:23:39

Message: 4 of 9

thanks a lot Per and Carlos. Will try to implement your
ideas and come back to you asap.


"carlos lopez" <clv2clv_00000000_@adinet.com.uy> wrote in
message <ferrjj$p7v$1@fred.mathworks.com>...
> "aravind bhimarasetty" <baravi.no.spam@mathworks.com> wrote
> in message <feq31p$ot4$1@fred.mathworks.com>...
> > Hi,
> >
> > Given that,
> > y = k1*x*sin(k2*x - w*t)
> > and
> > integral(x=0 to x0){sqrt(1+ (dy/dx)^2)} dx = L
> >
> > Now, I already have the numerical values of k1, k2, w, L. I
> > want to find out x0 that satisfies the above integral
> equation.
> This can be rephrased as an ODE
> dLenght/dx={sqrt(1+ (dy/dx)^2)} dx
> with initial value Length=0 for x=0
> You might run any ode solver taking into consideration the
> event " Length(x0)=L" as the end of the calculations. Look
> for 'Events' property of the OPTIONS valid for ode45
> Regards
> Carlos

Subject: solving for the upper limit in an integral !

From: aravind bhimarasetty

Date: 15 Oct, 2007 06:23:54

Message: 5 of 9

thanks a lot Per and Carlos. Will try to implement your
ideas and come back to you asap.


"carlos lopez" <clv2clv_00000000_@adinet.com.uy> wrote in
message <ferrjj$p7v$1@fred.mathworks.com>...
> "aravind bhimarasetty" <baravi.no.spam@mathworks.com> wrote
> in message <feq31p$ot4$1@fred.mathworks.com>...
> > Hi,
> >
> > Given that,
> > y = k1*x*sin(k2*x - w*t)
> > and
> > integral(x=0 to x0){sqrt(1+ (dy/dx)^2)} dx = L
> >
> > Now, I already have the numerical values of k1, k2, w, L. I
> > want to find out x0 that satisfies the above integral
> equation.
> This can be rephrased as an ODE
> dLenght/dx={sqrt(1+ (dy/dx)^2)} dx
> with initial value Length=0 for x=0
> You might run any ode solver taking into consideration the
> event " Length(x0)=L" as the end of the calculations. Look
> for 'Events' property of the OPTIONS valid for ode45
> Regards
> Carlos

Subject: solving for the upper limit in an integral !

From: aravind bhimarasetty

Date: 19 Oct, 2007 11:22:25

Message: 6 of 9

Hi,

Thanks a lot Per. Your solution works perfectly !!

Thanks Carlos for your suggestion but i may not try it :( as
I have my problem solved.


"aravind bhimarasetty" <baravi.no.spam@mathworks.com> wrote
in message <fev11q$cbu$1@fred.mathworks.com>...
> thanks a lot Per and Carlos. Will try to implement your
> ideas and come back to you asap.
>
>
> "carlos lopez" <clv2clv_00000000_@adinet.com.uy> wrote in
> message <ferrjj$p7v$1@fred.mathworks.com>...
> > "aravind bhimarasetty" <baravi.no.spam@mathworks.com> wrote
> > in message <feq31p$ot4$1@fred.mathworks.com>...
> > > Hi,
> > >
> > > Given that,
> > > y = k1*x*sin(k2*x - w*t)
> > > and
> > > integral(x=0 to x0){sqrt(1+ (dy/dx)^2)} dx = L
> > >
> > > Now, I already have the numerical values of k1, k2, w,
L. I
> > > want to find out x0 that satisfies the above integral
> > equation.
> > This can be rephrased as an ODE
> > dLenght/dx={sqrt(1+ (dy/dx)^2)} dx
> > with initial value Length=0 for x=0
> > You might run any ode solver taking into consideration the
> > event " Length(x0)=L" as the end of the calculations. Look
> > for 'Events' property of the OPTIONS valid for ode45
> > Regards
> > Carlos
>

Subject: solving for the upper limit in an integral !

From: XIANGCHAO ZHU

Date: 5 Sep, 2013 15:36:06

Message: 7 of 9

"carlos lopez" wrote in message <ferrjj$p7v$1@fred.mathworks.com>...
> "aravind bhimarasetty" <baravi.no.spam@mathworks.com> wrote
> in message <feq31p$ot4$1@fred.mathworks.com>...
> > Hi,
> >
> > Given that,
> > y = k1*x*sin(k2*x - w*t)
> > and
> > integral(x=0 to x0){sqrt(1+ (dy/dx)^2)} dx = L
> >
> > Now, I already have the numerical values of k1, k2, w, L. I
> > want to find out x0 that satisfies the above integral
> equation.
> This can be rephrased as an ODE
> dLenght/dx={sqrt(1+ (dy/dx)^2)} dx
> with initial value Length=0 for x=0
> You might run any ode solver taking into consideration the
> event " Length(x0)=L" as the end of the calculations. Look
> for 'Events' property of the OPTIONS valid for ode45
> Regards
> Carlos
Hi, Carlos, can you elaborate a bit, maybe some problems with the "Events". Thank you!

Subject: solving for the upper limit in an integral !

From: Torsten

Date: 6 Sep, 2013 06:29:06

Message: 8 of 9

"XIANGCHAO ZHU" wrote in message <l0a8d6$jtq$1@newscl01ah.mathworks.com>...
> "carlos lopez" wrote in message <ferrjj$p7v$1@fred.mathworks.com>...
> > "aravind bhimarasetty" <baravi.no.spam@mathworks.com> wrote
> > in message <feq31p$ot4$1@fred.mathworks.com>...
> > > Hi,
> > >
> > > Given that,
> > > y = k1*x*sin(k2*x - w*t)
> > > and
> > > integral(x=0 to x0){sqrt(1+ (dy/dx)^2)} dx = L
> > >
> > > Now, I already have the numerical values of k1, k2, w, L. I
> > > want to find out x0 that satisfies the above integral
> > equation.
> > This can be rephrased as an ODE
> > dLenght/dx={sqrt(1+ (dy/dx)^2)} dx
> > with initial value Length=0 for x=0
> > You might run any ode solver taking into consideration the
> > event " Length(x0)=L" as the end of the calculations. Look
> > for 'Events' property of the OPTIONS valid for ode45
> > Regards
> > Carlos
> Hi, Carlos, can you elaborate a bit, maybe some problems with the "Events". Thank you!

For the above function, it's one line of code:
xs=fzero(@(x)quad(@(y)sqrt(1+(k1*sin(k2*y-w*t)+k1*k2*y.*cos(k2*y-w*t))^2),0,x)-L,x0)
where x0 is a starting guess for the upper bound.
If your function is different from the one above, you will have to insert your dy/dx
instead of k1*sin(k2*y-w*t)+k1*k2*y.*cos(k2*y-w*t).

Best wishes
Torsten.

Subject: solving for the upper limit in an integral !

From: Torsten

Date: 6 Sep, 2013 06:32:06

Message: 9 of 9

"Torsten" wrote in message <l0bsni$t03$1@newscl01ah.mathworks.com>...
> "XIANGCHAO ZHU" wrote in message <l0a8d6$jtq$1@newscl01ah.mathworks.com>...
> > "carlos lopez" wrote in message <ferrjj$p7v$1@fred.mathworks.com>...
> > > "aravind bhimarasetty" <baravi.no.spam@mathworks.com> wrote
> > > in message <feq31p$ot4$1@fred.mathworks.com>...
> > > > Hi,
> > > >
> > > > Given that,
> > > > y = k1*x*sin(k2*x - w*t)
> > > > and
> > > > integral(x=0 to x0){sqrt(1+ (dy/dx)^2)} dx = L
> > > >
> > > > Now, I already have the numerical values of k1, k2, w, L. I
> > > > want to find out x0 that satisfies the above integral
> > > equation.
> > > This can be rephrased as an ODE
> > > dLenght/dx={sqrt(1+ (dy/dx)^2)} dx
> > > with initial value Length=0 for x=0
> > > You might run any ode solver taking into consideration the
> > > event " Length(x0)=L" as the end of the calculations. Look
> > > for 'Events' property of the OPTIONS valid for ode45
> > > Regards
> > > Carlos
> > Hi, Carlos, can you elaborate a bit, maybe some problems with the "Events". Thank you!
>
> For the above function, it's one line of code:
> xs=fzero(@(x)quad(@(y)sqrt(1+(k1*sin(k2*y-w*t)+k1*k2*y.*cos(k2*y-w*t))^2),0,x)-L,x0)

Sorry, should read
xs=fzero(@(x)quad(@(y)sqrt(1+(k1*sin(k2*y-w*t)+k1*k2*y.*cos(k2*y-w*t)).^2),0,x)-L,x0)

> where x0 is a starting guess for the upper bound.
> If your function is different from the one above, you will have to insert your dy/dx
> instead of k1*sin(k2*y-w*t)+k1*k2*y.*cos(k2*y-w*t).
>
> Best wishes
> Torsten.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us