Python: Multi variable nonlinear fitting like matlabs nlinfit
Asked Answered
A

0

6

I used to use Matlab to perform nonlinear fits using the nlinfit function. This allowed me to create a fit for a vector of observed responses to two predictors. Let's for arguments sake say Cu recovery through a separation process based on the feed grade and feed rate. When using Matlabs nlinfit(), the function accepted the Rec column of data as the observed response, and then a n by 2 matrix of predictors, in this case feed rate and feed grade.

I have now switched to using Python (NumPy, SciPy and MatPlotLib) instead of Matlab and cannot make the minimize function perform the same multiple variable nonlinear regression fitting. I have managed fine with a single predictor variable with many observations, but not a multiple variable predictor set.

Appanage answered 26/9, 2013 at 12:39 Comment(2)
could you post some code?Amaro
Can you post what you have tried thus far? Matlab's nlinfit function uses the Levenberg-Marquardt algorithm so you could try scipy.optimize.leastsq or scipy.optimize.curve_fit (looks like Matlab has a "robust" option).Guelph

© 2022 - 2024 — McMap. All rights reserved.