How to find the Jacobin of variables in the form x(i)

2 ビュー (過去 30 日間)
mohamed Faraj
mohamed Faraj 2020 年 5 月 15 日
回答済み: Ameer Hamza 2020 年 5 月 15 日
I have a set of nonlinear constraints in which the variables are defined in the form x(i). For example, I have c=1/(x(1)-x(2))+1/(x(3)-x(4)). How to find the jacobian of this constraint.

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 5 月 15 日
try this
x = sym('x', [1, 4]);
c = 1/(x(1)-x(2))+1/(x(3)-x(4));
jc = jacobian(c)
Result
jc =
[ -1/(x1 - x2)^2, 1/(x1 - x2)^2, -1/(x3 - x4)^2, 1/(x3 - x4)^2]

カテゴリ

Help Center および File ExchangeNonlinear Optimization についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by