Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: problam evaluating a simple calculation for a vector of values Date: Tue, 9 Dec 2008 18:07:01 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 11 Message-ID: <ghmc45$bbe$1@fred.mathworks.com> References: <ghj6ui$9m9$1@fred.mathworks.com> <ghjlba$abl$1@fred.mathworks.com> <ghlf9n$jtp$1@fred.mathworks.com> Reply-To: <HIDDEN> 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 1228846021 11630 172.30.248.37 (9 Dec 2008 18:07:01 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Tue, 9 Dec 2008 18:07:01 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:505897 "Arik g" <elalyg@gmail.com> wrote in message <ghlf9n$jtp$1@fred.mathworks.com>... > ......... > so when i run it for one value of dispeCost at a time, there's no aparant problem. when i run it for 2 or more, then the differnce between the extreme values kicks into action: if i run it for [0,0.1] - OK. for [0,0.05,0.1], also OK, and also OK for [0.005,0.1,0.3]. but for [0,0.1,0.3] or for [0,0.3] -NOT OK. the results for values 0 and 0.1 change this time from what they were when i ran them seperately, or as a couple [0,0.1]. > ......... In any for-loop procedure that I am aware of, the results of an iterated calculation should be precisely the same as those one would obtain doing them one at a time, provided that the input numerical quantities used are exactly the same and that there is no "feedback" between successive computations where one result depends on previous results. If you think you have an example to the contrary, you should present it with the all the numerical values specified so that others can check it for themselves. I think this is the only way you can get the assistance you are asking for. Also it would be advisable to make your example as brief as possible. You stated that you ran into trouble with a vector with only two values for dispeCost: [0,0.3]. How about showing us that one in detail? That means you would have to exactly specify what the values of p1aS, dVal1a, p1bS, and dVal1b are for each point of dispeCost and exactly how your for-loop code is written. Roger Stafford