MATLAB: Help with nonlinear regression

nonlinear regression

Hi, I'm trying to perform a non-linear regression analysis on my data because linear regression is not fitting the data (as you can see on the figure bellow)
It seems (for me) that the data will fit a 1/x-ish function but I don't know how to program it with the matlab function: nlinfit(X,Y,modelfun,beta0)
Can someone help me to perform the non linear regression and plot the resulting function? Thanks

Best Answer

Your data does not represent a function at all (there are multiple values of y for an x)
Are you interested in distribution fitting instead?
If you have the statistics toolbox, you can do nonlinear regression using NLINFIT or NonLinearModel.fit if you have a recent release of MATLAB.
Scroll down on the page to see examples, on how to use model fun. For 1/x will be @(x)1/x
Distribution fitting: