Path: news.mathworks.com!not-for-mail
From: "Ali " <alihaider82@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Attempted to access ; index out of bounds
Date: Sun, 19 Apr 2009 19:03:02 +0000 (UTC)
Organization: University of Belgrade
Lines: 25
Message-ID: <gsfsh6$4m3$1@fred.mathworks.com>
Reply-To: "Ali " <alihaider82@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1240167782 4803 172.30.248.35 (19 Apr 2009 19:03:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 19 Apr 2009 19:03:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440530
Xref: news.mathworks.com comp.soft-sys.matlab:533891


i have written this code listed below:

far(1) = 0.001;
for i=2:10000000
    far(i+1) = (h(1400,0,far(i)) - h(684,0,0))/(0.999*43100 - h(1400,0,far(i)));
 
    if abs(far(i) - far(i+1)) <= 0.001
         
        break       
       far(i)
    else
        return
    end
end

it gives erroe: ??? Attempted to access far(2); index out of bounds because
numel(far)=1.

Error in ==> far_iter at 4
    far(i+1) = (h(1400,0,far(i)) - h(684,0,0))/(0.999*43100 -
    h(1400,0,far(i)));

sometimes it works without changing anything,sometimes it gives error. Plz help me.
Ali