Why the optimization results of lsqnonlin are different in R2026a and R2025a?
I used the following code to solve a nonlinear optimization problem. All random seeds and optimization options are the same, but the result in the R2026a pre-release is complex-valued, whereas in R2025a or older releases the result is real-valued. All code and data are attached.
% R2025b or earier is real-base solution
% R2026a is complex-base solution?
R2025b:
load temp.mat
rng default;
options = optimoptions(‘lsqnonlin’, ‘Algorithm’,’levenberg-marquardt’, ‘Display’,’final’,…
‘MaxFunEvals’,2000, ‘MaxIter’,1e3, ‘TolFun’,1e-6, ‘TolX’,1e-6, ‘Jacobian’,’off’);
[x,resnorm,~,exitflag,output] = lsqnonlin(@(p)residual_KR_robust(double(X1_ok), double(X2_ok), imsize1, imsize2, p, 1000), [1000 1000 0 0 0],…
[],[])
R2026a:I used the following code to solve a nonlinear optimization problem. All random seeds and optimization options are the same, but the result in the R2026a pre-release is complex-valued, whereas in R2025a or older releases the result is real-valued. All code and data are attached.
% R2025b or earier is real-base solution
% R2026a is complex-base solution?
R2025b:
load temp.mat
rng default;
options = optimoptions(‘lsqnonlin’, ‘Algorithm’,’levenberg-marquardt’, ‘Display’,’final’,…
‘MaxFunEvals’,2000, ‘MaxIter’,1e3, ‘TolFun’,1e-6, ‘TolX’,1e-6, ‘Jacobian’,’off’);
[x,resnorm,~,exitflag,output] = lsqnonlin(@(p)residual_KR_robust(double(X1_ok), double(X2_ok), imsize1, imsize2, p, 1000), [1000 1000 0 0 0],…
[],[])
R2026a: I used the following code to solve a nonlinear optimization problem. All random seeds and optimization options are the same, but the result in the R2026a pre-release is complex-valued, whereas in R2025a or older releases the result is real-valued. All code and data are attached.
% R2025b or earier is real-base solution
% R2026a is complex-base solution?
R2025b:
load temp.mat
rng default;
options = optimoptions(‘lsqnonlin’, ‘Algorithm’,’levenberg-marquardt’, ‘Display’,’final’,…
‘MaxFunEvals’,2000, ‘MaxIter’,1e3, ‘TolFun’,1e-6, ‘TolX’,1e-6, ‘Jacobian’,’off’);
[x,resnorm,~,exitflag,output] = lsqnonlin(@(p)residual_KR_robust(double(X1_ok), double(X2_ok), imsize1, imsize2, p, 1000), [1000 1000 0 0 0],…
[],[])
R2026a: optimization MATLAB Answers — New Questions









