isqnonlin: compute part of objective function outside of matlab

8 vues (au cours des 30 derniers jours)
SA-W
SA-W le 11 Août 2022
Commenté : SA-W le 17 Oct 2022
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 commentaires
SA-W
SA-W le 12 Août 2022
I can transfer data between my PDE solver and MATLAB, that is no problem.

Connectez-vous pour commenter.

Réponse acceptée

Torsten
Torsten le 12 Août 2022
Modifié(e) : Torsten le 12 Août 2022
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 commentaires