Path: news.mathworks.com!not-for-mail
From: "Sean Douglas" <seanjdouglas@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Fixed point Iteration (multivariable) 2
Date: Thu, 2 Jul 2009 17:15:21 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 60
Message-ID: <h2ipv9$h8m$1@fred.mathworks.com>
Reply-To: "Sean Douglas" <seanjdouglas@hotmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246554921 17686 172.30.248.38 (2 Jul 2009 17:15:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 2 Jul 2009 17:15:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1894011
Xref: news.mathworks.com comp.soft-sys.matlab:552460


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.