Path: news.mathworks.com!not-for-mail
From: "Sean Douglas" <seanjdouglas@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Fixed point Iteration (multivariable) 2
Date: Thu, 2 Jul 2009 20:37:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 95
Message-ID: <h2j5pd$i0k$1@fred.mathworks.com>
References: <h2ipv9$h8m$1@fred.mathworks.com> <h2j3hu$mq4$1@fred.mathworks.com>
Reply-To: "Sean Douglas" <seanjdouglas@hotmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246567021 18452 172.30.248.37 (2 Jul 2009 20:37:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 2 Jul 2009 20:37:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1894011
Xref: news.mathworks.com comp.soft-sys.matlab:552544


Thank you very much for response - just giving me new ideas helps alot. 

square brackets[] will turn it into a matrix, I dont know if I want that even though the output get transposed at the end of the mfile.

BTW I did not need to use square brackets when I did the single variable problem that i put as an example in my previous question.
I dont know yet though,  you may be on to something 

thanks Steve



"Steve Conahan" <sconahan@mathworks.com> wrote in message <h2j3hu$mq4$1@fred.mathworks.com>...
> Hi Sean,
> 
> > ??? Error: File: fpixy.m Line: 7 Column: 9
> 
> As indicated, Line: 7 needs some re-writing:
> 
>   x(1)=(x0,y0);
> 
> I am not exactly sure what you are trying to do, but I suspect that the 
> right hand side of the above equation is not written correctly...perhaps you 
> need square braces [ instead of parentheses ( on the right hand side...
> 
> hth,
> Steve
> 
> 
> "Sean Douglas" <seanjdouglas@hotmail.com> wrote in message 
> news:h2ipv9$h8m$1@fred.mathworks.com...
> > Hello I am trying to perform fixed point iteration on this problem:
> > x1=g1(x1,x2)=(x1^2+x2^2+8)/10,   x2=g2(x1,x2)=(x1*x2^2+x1+8)/10
> >
> > first I made it one variable since I am x1 and x2 will be equal to each 
> > other anyways.                  Here is my mfile:
> > %Computes approximate solution of g(x)=x
> > %Input: inline function g, starting guess x0,
> > %       number of steps k
> > %Output: Approximate solution xc
> > function xc=fpi(g,x0,k)
> > x(1)=x0;
> > for i=1:k
> >  x(i+1)=g(x(i));
> > end
> > x'                 %transpose output to a column
> > xc=x(k+1);
> >
> > then I defined x and did the inline function:
> >>> clear
> >>> x=-10:.001:10;
> >>> x=fpi(inline('((x.^2+x.^2+8)/10)'),.5,2)
> >
> > ans =
> >
> >    0.5000
> >    0.8500
> >    0.9445
> >
> >
> > x =
> >
> > 0.9445 this worked nicely
> >
> >
> > Now I am trying to do this how the question was set up (with 
> > mulivariables). I changed my mfile and tried to do it. Here is what I have 
> > been up to:
> > First here is my new modified mfile:
> > %Attempting to set up multivariable Fixed-Point Iteration
> > %Computes approximate solution of g(x)=x
> > %Input: inline function g, starting guess x0,
> > %       number of steps k
> > %Output: Approximate solution xc
> > function xc=fpi(g,x0,y0,k)
> > x(1)=(x0,y0);
> > for i=1:k
> >  x(i+1)=g(x(i),y(i));
> > end
> > x'                 %transpose output to a column
> > xc=x(k+1);
> >
> > &#8230; and here is me calling the function and the MATLAB response
> >>> clear
> > x=-10:.001:10;
> > y=-10:.001:10;
> >>> x=fpixy(inline('((x.^2+y.^2+8)/10)'),.5,.5,2)
> > ??? Error: File: fpixy.m Line: 7 Column: 9
> > Expression or statement is incorrect--possibly unbalanced (, {, or [.
> >
> > I am pretty sure that it is not unbalaced, but something must be wrong 
> > with line 7 of my mfile, which is:  x(1)=(x0,y0);
> >
> > Can I even do a multivariable FPI?
> > I hope I described my situation clearly. Thanks for any help. 
>