필터 지우기
필터 지우기

lsqnonlin (lsqcurvefit , fmincon) does not change the variables in an optimization process to find the best fit

조회 수: 2 (최근 30일)
I'm perfoming an optimization of parameters. The main difference between my work and a regular curvefiiting problem is that the function that should be fitted is one that obtains x-y data from a third party simulation software. Here is the main section of the code:
u_test = []; f_test = []; % Anything
x0 = [22,280];
force = @(x) sim_res(x,u_test,f_test) - f_test;
x = lsqnonlin(force,x0,[4,199],[40,350]);
and here is the function that goes into another software (ABAQUS) and obtains some simulation results (a set of x-y data):
function force = sim_res(x,u_test,f_test)
inp_initial(x(1),x(2)); % Replaces new coefficients for new iteration
pause(2)
system('abaqus job=Al.inp user=NONLINEAR.for cpus=4 interactive' )
pause(2)
while exist('Al.lck','file')==2 % Some files have to be deleted
pause(0.1)
end
while exist('Al.odb','file')==0 % Some files have to be deleted
pause(0.1)
end
[dis,force] = Read_ODB_outputs_node(); % Another function that obtains results
plot(dis,force,u_test,f_test)
% Some files have to be deleted
delete('Al.prt');
delete('Al.com');
delete('Al.sim');
delete('Al.dat');
delete('Al.log');
end
The problem is that lsqnonlin does not change the initial values of x and after 2-3 iterations, the process stops and converges. The same happens with lsqcurvefit and fmincon. Can anyone find a solution for this?
Thanks in advance

채택된 답변

Torsten
Torsten 2024년 3월 25일
이동: Torsten 2024년 3월 25일
We don't know if you get modified values for the array "force" from "ABAQUS" if the input vector "x" to "sim_res" is slightly changed by "lsqnonlin". If this is not the case, "lsqnonlin" will think that changing the parameters does not change the objective function and stops - usually with the message that the initial point is optimal.
  댓글 수: 13
Esi Tesi
Esi Tesi 2024년 4월 2일
I've tried these vaues (1e-6, 1e-3, 1e-2, 1e-1) for FiniteDifferenceStepSize and got the same result that after a few iterations, the solver gets stuck at some specific x value and iterates on them without any progress. Is there any option or parameter that controls this action?
Torsten
Torsten 2024년 4월 2일
I don't know the reason. Most probably, the values coming from ABAQUS are too inexact. This would cause that computing reliable derivatives with respect to the parameters being fitted fails.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Matt J
Matt J 2024년 3월 26일
편집: Matt J 2024년 3월 26일

카테고리

Help CenterFile Exchange에서 Nonlinear Least Squares (Curve Fitting)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by