|
-
June 13th, 2018, 10:08 AM
#1
How to optimize a lsqnonlin function in matlab?
I have a set of parameters that I want to have them returned as result of the non-linear optimization through, the function *lsqnonlin*. The code is for an inverse problem, which gives a set of ThermoMechanical parameters in function of the displacement of a metallic bar. The problem, is that the optimization returns to me an aproximated value or almost the same as the starting point (X0). When it should be giving the result equal or aproximate to those of the variables. For that, I tried the input argument 'options', trying to change the number of MaxIter, MaxFunEval and the function tolerance. As a result of the program it alxays gives the same anszer:"*Optimization completed because the size of the gradient is less than
the default value of the optimality tolerance.*" What can I do to improve the optimization? Thank you for your help.
tf = 20;
t=0:0.1:tf;
Texcel = xlsread ('Classeur(19_04).xls',1,'L2:L202');
ResSpline = spline (t,Texcel);
plot(t,ppval(mkpp(ResSpline.breaks,ResSpline.coefs),t));
ParamThermMec; %Thermo-mechanical parameters defined by the array X0=[coeff_dilat G Cp lanbda Rho]
nu = 0.3; %Poisson's coefficient
Ucomsol = xlsread ('Classeur(19_04).xls',2,'L2:L202'); %displacement from Classeur(19_04).xls
figure (1)
hold on
yyaxis left
plot (t,Ucomsol)
yyaxis right
plot (t,Texcel)
xlim([0 20])
fun = @(X)(deplacement_lsq(0,ResSpline,X)-Ucomsol); %function to minimize
[temps,Umatlab_bauzin] = DeplacementSpline(0,ResSpline,1);
plot(t,Umatlab_bauzin,'b',t,Ucomsol,'g');
X0 = X/2; %initial value or starting point
options.TolFun=0.0000000000000000000000000000000000000001;
[ParametresTM,resnorm,residual,exitflag,output]=lsqnonlin(fun,X0,[0 0 0 0 0],[10 999999999999 2500 500 4000],options); %nonlinear minimisation
DiffXP=X-ParametresTM;
EX=[DiffXP(1)/X(1) DiffXP(2)/X(2) DiffXP(3)/X(3) DiffXP(4)/X(4) DiffXP(5)/X(5)]*100; %Percentage difference
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|