lsqcurvefit UseParallel error on matlab 2016b

I am receiving a strange error when trying to use the lsqcurvefit. When executing the following (taken from https://uk.mathworks.com/help/optim/ug/lsqcurvefit.html) I receive an error 'Reference to non-existent field 'UseParallel'.' See below for full error.
Note, I did not receive this error on older version so of Matlab e.g. 2015a.
Code
xdata = ... [0.9 1.5 13.8 19.8 24.1 28.2 35.2 60.3 74.6 81.3]; ydata = ... [455.2 428.6 124.1 67.3 43.2 28.1 13.1 -0.4 -1.3 -1.5];
fun = @(x,xdata)x(1)*exp(x(2)*xdata);
x0 = [100,-1]; x = lsqcurvefit(fun,x0,xdata,ydata)
Full Error:
Reference to non-existent field 'UseParallel'.
Error in computeFinDiffGradAndJac
Error in sfdnls (line 97) computeFinDiffGradAndJac(x,funfcn,confcn,valx, ...
Error in snls (line 179) [A,findiffevals] = sfdnls(xcurr,fvec,Jstr,group,[],funfcn,l,u,...
Error in lsqncommon (line 151) snls(funfcn,xC,lb,ub,flags.verbosity,options,defaultopt,initVals.F,initVals.J,caller, ...
Error in lsqcurvefit (line 257) lsqncommon(funfcn,xCurrent,lb,ub,options,defaultopt,caller,...
Thanks in advance for your help.

답변 (1개)

Alan Weiss
Alan Weiss 2017년 1월 19일

0 개 추천

It sounds to me as if your MATLAB installation is corrupted somehow. Try reinstalling, or at least reinstalling Optimization Toolbox.
If reinstalling does not help, then please contact technical support.
Alan Weiss
MATLAB mathematical toolbox documentation

댓글 수: 1

Hi Alan,
Thanks for the response.
Interestingly, I managed to get this working by explicitly setting the option UseParallel to False:
xdata = ...
[0.9 1.5 13.8 19.8 24.1 28.2 35.2 60.3 74.6 81.3];
ydata = ...
[455.2 428.6 124.1 67.3 43.2 28.1 13.1 -0.4 -1.3 -1.5];
options = optimset('UseParallel', false);
fun = @(x,xdata)x(1)*exp(x(2)*xdata);
x0 = [100,-1];
lb = []
ub = []
x = lsqcurvefit(fun,x0,xdata,ydata,lb,ub,options)
This runs without error producing the following result as expected:
x =
498.8309 -0.1013

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

카테고리

도움말 센터File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

질문:

2017년 1월 18일

댓글:

2017년 1월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by