isqnonlin: compute part of objective function outside of matlab

5 ビュー (過去 30 日間)
SA-W
SA-W 2022 年 8 月 11 日
コメント済み: SA-W 2022 年 10 月 17 日
I am solving a partial differential equation depending on some design variables (material parameters). I want to fit the material parameters to the vector of experimental data y using matlabs function isqnonlin.
I am solving the PDE for given material parameters with an external software; the solution vector thus obtained is denoted as s. What I want to minimize is the squared difference between s and y in the l2-norm by using the algorithm implemented in isqnonlin.
Given that I do not compute the PDE solution s in matlab itself, is it possible to use isqnonlin?
  2 件のコメント
Torsten
Torsten 2022 年 8 月 12 日
And did you already test the data transfer between your PDE solver and MATLAB ?
SA-W
SA-W 2022 年 8 月 12 日
I can transfer data between my PDE solver and MATLAB, that is no problem.

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

採用された回答

Torsten
Torsten 2022 年 8 月 12 日
編集済み: Torsten 2022 年 8 月 12 日
Then call "lsqnonlin" as
p0 = ...; % initial guess for the vector of material parameters
sol = lsqnonlin(@(p)fun(p,y),p0)
and write a function "fun" as
function res = fun(p,y)
s = result_from_your_PDE_solver_for_the_vector_of_material_parameters_p_corresponding_to_y(p)
res = s - y;
end
By the way:
The name of the MATLAB function is lsqnonlin (least-squares solver for nonlinear problems), not isqnonlin.
  134 件のコメント
SA-W
SA-W 2022 年 9 月 16 日
"IMO, sorry to tell you directly but it is not serious to work with J with condition number of 1e12, exitflag = 3 and gradient test fail. You must to make those numerical obstacles going away before conclude anything that is trustworty."
The gradient check does not fail anymore. Also, for example, a start vector
p0 = [100000;50000;0;50000;100000]
converges to the true exact solution
p = [21844;5183;0;4844;18939]
. The associated exitflag = 3, although it is the true solution (synthetic data).
You are absolutely right with the bad condition number of J. I am wondering anyway how such a Jacobian results in the correct solution?
I am not sure if I can scale my parameters, because these are material parameters and my pde solver does not converge at all if I change the order of magnitude of them somehow. Is there a way to scale the COMPUTED Jacobian to reduce the condition number or do I have to compute J with scaled parameters?
SA-W
SA-W 2022 年 10 月 17 日
Sorry that I come back on this again. But I would appreciate your feedback in this regard:
If the parameters at some point during optimization do not change anymore, what might be useful to check for underlying reasons?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBoundary Conditions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by