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 an equation through iterations

Subject: Solving an equation through iterations

From: Charlie Vlieland-Boddy

Date: 23 Jul, 2010 17:41:06

Message: 1 of 7

Hi guys hope you can help, i've had a lot of trouble trying to solve an equation for a particular parameter.

I have written the basic equation and it looks something like this:

L=((T_2(L,a,b,c)-c*q_2(a,b,c))-F(L,a,b,c)-(P(L,a,b,c)-c)(D_2-Q(L,a,b,c))/
    ((T_2(L,a,b,c)-c*q_2(a,b,c)-(P(L,a,b,c)-c)(D_2-Q(L,a,b,c)-(T_1(L,a,b,c)-c*q_1(L,a,b,c))

I want to solve for L using an iterative procedure, as I want it to converge to the true value for L. how do i do this?

I can specify all the parameters except L, then what is the syntax and how do I restrict the iterations, I know L is bounded between [0,1].

cheers

Subject: Solving an equation through iterations

From: Matt J

Date: 23 Jul, 2010 19:12:20

Message: 2 of 7


See the help doc for fzero()

Subject: Solving an equation through iterations

From: Walter Roberson

Date: 23 Jul, 2010 19:16:53

Message: 3 of 7

Matt J wrote:
>
> See the help doc for fzero()

Not applicable to this particular case. The OP wants to find a "fixed point"
rather than a root.

repeat currentvalue <- f(oldvalue), leaving loop if oldvalue is the same as
current value and otherwise setting oldvalue <- currentvalue and looping back
again

(deliberately not done in matlab syntax to leave the OP room for creative input)

Subject: Solving an equation through iterations

From: Matt J

Date: 23 Jul, 2010 19:39:08

Message: 4 of 7

Walter Roberson <roberson@hushmail.com> wrote in message <i2cq2c$qu8$1@canopus.cc.umanitoba.ca>...
> Matt J wrote:
> >
> > See the help doc for fzero()
>
> Not applicable to this particular case. The OP wants to find a "fixed point"
> rather than a root.

But solving the fixed point equation

L=f(L)

is equivalent to finding a root of L-f(L)

Subject: Solving an equation through iterations

From: Walter Roberson

Date: 23 Jul, 2010 19:59:31

Message: 5 of 7

Matt J wrote:
> Walter Roberson <roberson@hushmail.com> wrote in message
> <i2cq2c$qu8$1@canopus.cc.umanitoba.ca>...
>> Matt J wrote:
>> > > See the help doc for fzero()
>>
>> Not applicable to this particular case. The OP wants to find a "fixed
>> point" rather than a root.
>
> But solving the fixed point equation
>
> L=f(L)
>
> is equivalent to finding a root of L-f(L)

f = @(x) 1-x;
L = 0;

f(0) -> 1, f(1) -> 0, and around and around we go, whereas x = 1-x would
quickly solve to x = 1/2 .

Finding a fixed point through iteration as the OP wants to do is thus not the
same as finding the root.

Finding a fixed point through iteration can end up looping through all
possible floating point values, if the equation happens to be chaotic. Or it
could simply loop indefinitely due to precision problems. Up to the original
poster to figure out what they want to do about these issues.

Subject: Solving an equation through iterations

From: Matt J

Date: 23 Jul, 2010 20:14:04

Message: 6 of 7

Walter Roberson <roberson@hushmail.com> wrote in message <i2csia$1jf$1@canopus.cc.umanitoba.ca>...
> Matt J wrote:
> > Walter Roberson <roberson@hushmail.com> wrote in message
> > <i2cq2c$qu8$1@canopus.cc.umanitoba.ca>...
> >> Matt J wrote:
> >> > > See the help doc for fzero()
> >>
> >> Not applicable to this particular case. The OP wants to find a "fixed
> >> point" rather than a root.
> >
> > But solving the fixed point equation
> >
> > L=f(L)
> >
> > is equivalent to finding a root of L-f(L)
>
> f = @(x) 1-x;
> L = 0;
>
> f(0) -> 1, f(1) -> 0, and around and around we go, whereas x = 1-x would
> quickly solve to x = 1/2 .
>
> Finding a fixed point through iteration as the OP wants to do is thus not the
> same as finding the root.
========

Well that's true, in the sense that this manner of iteration won't necessarily solve the equation. Although, it is not remotely clear to me from the phrasing of the OP that this particular iterative procedure (as opposed to the one used by fzero) was the one he wanted to use.

Subject: Solving an equation through iterations

From: mecej4

Date: 10 Oct, 2010 18:06:43

Message: 7 of 7

On 7/23/2010 2:12 PM, Matt J wrote:
>
> See the help doc for fzero()
Just to clarify: the function g(L) whose root you can find using
fzero(), such that the root of g(L) = 0 is the fixed point of the
equation you wrote, is

g(L) := L -
((T_2(L,a,b,c)-c*q_2(a,b,c))-F(L,a,b,c)-(P(L,a,b,c)-c)(D_2-Q(L,a,b,c))/
 
((T_2(L,a,b,c)-c*q_2(a,b,c)-(P(L,a,b,c)-c)(D_2-Q(L,a,b,c)-(T_1(L,a,b,c)-c*q_1(L,a,b,c))


-- mecej4

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