Fix Secant method bounds between two positive values

Hi,
I am using Secant Mehtod to find roots of a system of nonlinear algebraic equations. all the x[i] varibales should be at specific range, for instance, [0 50]. My question is how to set the lower and upper bounds when we know x[i] is loacted between lower and upper values?
In Secant Method, after 4 iteration, the new x becomes negative. Is there any way to avoid the bounds?
It would be appreciated if you comment on these question.
Thank you.

2 件のコメント

Geoff Hayes
Geoff Hayes 2019 年 6 月 9 日
sina - you may need to show some of the code that you have written so that we can get an idea of how you have implemented this algorithm.
sina
sina 2019 年 6 月 9 日
Hi Geoff,
You're right. But I defined a function which was linked to another software (Aspen) through
actxserver('Apwn.Document.36.0');
so, it cannot be run on your PC.

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 6 月 9 日

0 投票

lb = 0; ub = 50;
x(1) = lb;
x(2) = ub;
while ...
newx = ...
if newx < lb; newx = lb; end
if newx > ub; newx = ub; end
x(K) = newx;
end

1 件のコメント

sina
sina 2019 年 6 月 9 日
Thank you Walter for the answer.
I modified my code and added the new if statement. But f(x) remained constant for the rest of iteration!
I am thinking about defineing t as a varibale. When t chnages, then newx = f(t). And newx stands between 0 and 50. This idea, I am not sure whether technically is correct.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDynamic System Models についてさらに検索

質問済み:

2019 年 6 月 9 日

コメント済み:

2019 年 6 月 9 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by