Moving from nlinfit to lsqnonlin?

조회 수: 3 (최근 30일)
Laith Alhussein
Laith Alhussein 2016년 2월 25일
댓글: John Alperto 2016년 2월 25일
I want to estimate the parameters of a nonlinear model. Using nlinfit so far works, and makes sense to me. I use it in the following way:
b=nlinfit(x_data,y_data,@my_model,initial_guess);
However, I want to add constraints to the parameters I'm estimating, which is why I'm trying to switch to lsqnonlin. I'm having a hard time translating my problem to this function though. After looking at the documentation, I can't see how I can pass the x and y data using this function. I literally just need what nlinfit does except with constraints to the parameters. Do I need to somehow make the "my_model" function accept the x and y data instead? Any help would be appreciated.
  댓글 수: 1
John D'Errico
John D'Errico 2016년 2월 25일
lsqnonlin does not allow general constraints. Only bound constraints.

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

답변 (1개)

Sean de Wolski
Sean de Wolski 2016년 2월 25일
lsqcurvefit is essentially the same thing as lsqnonlin but accepts data and functions in the same manner you're used to.
  댓글 수: 1
John Alperto
John Alperto 2016년 2월 25일
OK, let me give this a shot.

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

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by