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 unknown in eqn with integral

Subject: Solving unknown in eqn with integral

From: Amisha Shah

Date: 30 May, 2010 00:31:04

Message: 1 of 3

Dear Community,

I have one equation and one unknown but the unknown is imbedded in an integral.

For example:

x +5 = x^2 + integral (x*y2)dy (boundary from 0,1)

I would like to solve for x using lsqnonlin but unsure how to incorporate the integral into it.

Please help!

Thanks!

Amisha

Subject: Solving unknown in eqn with integral

From: Walter Roberson

Date: 30 May, 2010 01:16:34

Message: 2 of 3

Amisha Shah wrote:

> I have one equation and one unknown but the unknown is imbedded in an
> integral.

> For example:
>
> x +5 = x^2 + integral (x*y2)dy (boundary from 0,1)

> I would like to solve for x using lsqnonlin but unsure how to
> incorporate the integral into it.

For something like that you can get exact answers using the symbolic
solver, if you have the symbolic toolkit.

In Maple notation it would be

 > solve(x+5=x^2+int(x*y^2,y=0..1),x);

   1/3-1/3*46^(1/2), 1/3+1/3*46^(1/2)

This does, of course, depend upon the expression being integrated being
fourth degree or less in x .

Subject: Solving unknown in eqn with integral

From: Roger Stafford

Date: 30 May, 2010 01:41:04

Message: 3 of 3

"Amisha Shah" <ads@alum.wustl.edu> wrote in message <htsbk8$hk$1@fred.mathworks.com>...
> Dear Community,
>
> I have one equation and one unknown but the unknown is imbedded in an integral.
>
> For example:
>
> x +5 = x^2 + integral (x*y2)dy (boundary from 0,1)
>
> I would like to solve for x using lsqnonlin but unsure how to incorporate the integral into it.
>
> Please help!
>
> Thanks!
>
> Amisha

  For the particular example you give, an x can be factored from the integral leaving a function of y whose integral you can easily solve by calculus. This leaves you a quadratic equation which you can also solve by hand.

  However in general if you have an equation of the form

 f(x) + int(g(x,y))dy = 0

you could define a function which accepts x and computes the left side of this equation by way of one of the integration functions and use this function's handle in a call to fzero or fsolve. You should be sure and write the function in such a manner that it can accept multiple values of x in a vector, which of course means multiple calls on the integration routine.

Roger Stafford

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