Moving from nlinfit to lsqnonlin?

1 visualización (últimos 30 días)
Laith Alhussein
Laith Alhussein el 25 de Feb. de 2016
Comentada: John Alperto el 25 de Feb. de 2016
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 comentario
John D'Errico
John D'Errico el 25 de Feb. de 2016
lsqnonlin does not allow general constraints. Only bound constraints.

Iniciar sesión para comentar.

Respuestas (1)

Sean de Wolski
Sean de Wolski el 25 de Feb. de 2016
lsqcurvefit is essentially the same thing as lsqnonlin but accepts data and functions in the same manner you're used to.

Categorías

Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by