Solving a system of nonlinear equations with unorganized unknowns?

2 ビュー (過去 30 日間)
Devanjith Fonseka
Devanjith Fonseka 2019 年 10 月 4 日
編集済み: Matt J 2019 年 10 月 6 日
Ideally when using fsolve, my entire solution vector will be unknown. However my unknowns are broken down into 2 vectors x and r such that some values of my x vector are always fixed as they are boundary conditions but the summation of the length of x which are unknown, and r gives me the total number of unknowns. Is there a way I can use fsolve to pick the indices I would like it to solve leaving the boundary conditions the way they are?.

回答 (1 件)

Matt J
Matt J 2019 年 10 月 4 日
編集済み: Matt J 2019 年 10 月 4 日
If you use lsqnonlin instead of fsolve, you can set a vector of upper and lower bounds ub and lb on the solution. Just set ub(i)=lb(i) for those x(i) elements you want constrained to something known, e.g.,
p0=[x0(:);r0(:)]; %Initial guess
N=numel(p0);
[lb,ub]=deal(-inf(N,1), +inf(N,1));
ub(1:3)=10; lb(1:3)=10; %constrain x(1:3) to equal 10
p=lsqnonlin(@yourFunction,p0,lb,ub)
  4 件のコメント
Devanjith Fonseka
Devanjith Fonseka 2019 年 10 月 4 日
Hello,
I implemented it and I get this error:
The Levenberg-Marquardt algorithm does not handle bound constraints and the trust-region-reflective algorithm requires at
least as many equations as variables; aborting.
I expected this to occur considering that even though I constrain my vector to take a specific value for my known variables, I would be left with too many variables.
Is there any work around to this?
Matt J
Matt J 2019 年 10 月 5 日
編集済み: Matt J 2019 年 10 月 6 日
If you have fewer equations than unknowns then it is not clear what you hope for as a result. There will normally be infinite solutions in that situation, and the problem will be ill-posed.

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

カテゴリ

Help Center および File ExchangeSystems of Nonlinear Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by