Problem with subfunction within lsqnonlin??

조회 수: 1 (최근 30일)
Becket Hui
Becket Hui 2012년 9월 9일
댓글: Pranav Pathak 2018년 7월 27일
I got the following error which involves matlab not knowing how to multiply a scalar with a sparse structure (which is just another number). Does anyone know what is going on?
Error using * MTIMES is not supported for one sparse input and one single input.
Error in trdog (line 30) grad = D*g;
Error in snls (line 315) [sx,snod,qp,posdef,pcgit,Z] = trdog(x,g,A,D,delta,dv,...
Error in lsqncommon (line 175) [xC,FVAL,LAMBDA,JACOB,EXITFLAG,OUTPUT,msgData]=...
Error in lsqnonlin (line 237) [xCurrent,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
Error in DCE_Analysis (line 35) [Pfinal, chi2] = lsqnonlin(@(P)lSqErr(insignal,inserr,tarr,AIFp,R1T,P),Pstart,Plb,Pub,options);
  댓글 수: 1
Becket Hui
Becket Hui 2012년 9월 10일
I think I figured it out, it appears that everything must be type double (can't be single) or else it will fail.

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

답변 (1개)

Steve Grikschat
Steve Grikschat 2012년 9월 25일
All values returned to lsqnonlin must be of data type double.
  댓글 수: 1
Pranav Pathak
Pranav Pathak 2018년 7월 27일
Hello Sir,
Do we have any work around for this case?
I need to pass a single datatype value to the lsqnonlin function.
With Typecasting, I am able to resolve the error but this procedure does NOT optimize the value. It stops after one iteration.
Please let me know your feedback.

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

카테고리

Help CenterFile Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by