i’ve a problem to understand this snippet of code
output=lsqnonlin(@(argn) fun(arg1,arg2,argn),X0);
My idea is that lsqnonlin will call the argn->fun function recursively,but i’m not sure.
is it right?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is impossible to say what
lsqnonlinwill do without the functions’ code. However, there is nothing inherently recursive in the function call in your question.The 1st argument to
lsqnonlinis a function handle, and in the function call in your question, you pass an anonymous function handle:Which is a function with one argument to be used by the function,
argn, and two parameters (are pre-set arguments),arg1andarg2.lsqnonlinuses the function handle you pass it in order to calculate the function value in a specific point or vector of points.You can read more about anonymous function handle here: http://www.mathworks.com/help/techdoc/matlab_prog/f4-70115.html#f4-70133