set parameters of nlinfit function

5 次查看(过去 30 天)
Hi
I’m beginner in MATLAB. I have some experimental points and I used nlinfit function to solve my problem and find the best LS curve fitting result. When I use the nlinfit, it pass MSE= 1.5873e+07 and the result is not very good. I attached my data, please check output of nlinfit function to see the output.
Note: I want to find the best curve fitting based on spherical model, soI use: fun = @(p,X) p(1)*(1.5*X/p(2)-0.5*(X/p(2)).^3);
How I should set function’s arguments to reach the best results? Please help me to solve my problem.
Best regards

采纳的回答

Star Strider
Star Strider 2014-9-14
One problem might be that you did not completely vectorise your objective function code (notably the divisions and at least one multiplication. I did here, so that could help:
fun = @(p,X) p(1).*(1.5*X./p(2)-0.5*(X./p(2)).^3);
See if running it makes a difference. If it solves your problem, let me know.
I’d actually like to know a bit more about what you did. It would help to know your starting parameter estimates.
Past midnight here, so I’ll run your code with your data later in the morning and see what results I get.
  10 个评论
Mani Ahmadian
Mani Ahmadian 2014-9-16
Of course... you helped me to solve the most parts of my problem. But condition of spherical model doesn't satisfied me. I think it's diagram is out of tune and its mse is a huge value. I guess I have a big calculation or mathematical mistake about it, but I'm not sure where probably it happens.
I downloaded some textbooks about nonlinear curve fitting and I'll study them as soon as possible to have better understand.
Your view points and guidance was very helpful for me. Thank you very much, my friend.
Have a good time. Mani
Star Strider
Star Strider 2014-9-16
My pleasure!
Compare the MSE values for the various models. If any of the models adequately explain the process that produced your data, those should take precedence. If they all do, then the one with the lowest MSE is likely the correct one. If with the Likelihood Ratio Test they are not significantly different from the one with the lowest MSE, they are all valid. Developing and estimating other models that could explain your data are appropriate and acceptable. If you can find a more appropriate model, fit it as well and compare it to the others. That is the fun — and frustration — of nonlinear parameter estimation and mathematical modeling.
You have fun as well! I wish you well in your research. We’re here if you need us for other MATLAB projects.

请先登录,再进行评论。

更多回答(1 个)

Mani Ahmadian
Mani Ahmadian 2014-10-2
编辑:Mani Ahmadian 2014-10-2
Hi again
I'm trying to solve the problem with spherical model fit function, this model has a mathematical formula as below:
I think the un-fit problem is due to two criteria function of above model. I don't know how I should define this type of function to nlinfit.
Would you please help me to solve the problem?
Thanks
Mani
  12 个评论
Mani Ahmadian
Mani Ahmadian 2014-10-15
Great
Thanks for your nice job. I'll check it as soon as possible.
Have a nice time
Mani

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Fit Postprocessing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by