How to remove the data-type error in lsqcurvefit ?

조회 수: 1 (최근 30일)
Suraj
Suraj 2012년 12월 24일
Hello,
I am using MATLAB version R2006b.
I have a doubt in the optimization function "LSQCURVEFIT".
I have written the argument in command window as:
S = lsqcurvefit(@optim, kro, Cdata, ydata)
where "S" is a optim function input argument variable as:
function F = optim(S,Cdata);
Please note that both Cdata and ydata that I am supplying are double type arrays.
When I am running the lsqcurvefit command in command window the error that is coming is:
**LSQCURVEFIT cannot continue because user supplied objective function failed with the following error: Undefined function or method 'S' for input arguments of type 'double'.
Error in ==> lsqcurvefit at 182 [x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...**
Please help how should I resolve this issue ?
  댓글 수: 1
Suraj
Suraj 2012년 12월 24일
Also kro is a double type array.
Thanks

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

채택된 답변

Laura Proctor
Laura Proctor 2012년 12월 24일
It looks like the issue might be in the optim function in the use of the input variable S. Can you make a simple call to optim without receiving the error?
  댓글 수: 1
Suraj
Suraj 2012년 12월 24일
Hey, Thanks a lot.
S is a input variable to the optim function. The value of S will be the output of lsqcurvefit.
Now, I just want to know how should I simply call the optim.m function ?
There is another input to the function optim.m which is Cdata.
In the command window, I am supplying the value of Cdata.
And then I am using "run optim.m"
I don't why it is showing "Input argument Cdata is undefined"
Help please.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by