set parameters of nlinfit function

7 Ansichten (letzte 30 Tage)
Mani Ahmadian
Mani Ahmadian am 14 Sep. 2014
Kommentiert: Star Strider am 15 Okt. 2014
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

Akzeptierte Antwort

Star Strider
Star Strider am 14 Sep. 2014
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 Kommentare
Mani Ahmadian
Mani Ahmadian am 16 Sep. 2014
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 am 16 Sep. 2014
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Mani Ahmadian
Mani Ahmadian am 2 Okt. 2014
Bearbeitet: Mani Ahmadian am 2 Okt. 2014
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 Kommentare
Mani Ahmadian
Mani Ahmadian am 15 Okt. 2014
Great
Thanks for your nice job. I'll check it as soon as possible.
Have a nice time
Mani
Star Strider
Star Strider am 15 Okt. 2014
My pleasure!
You too!

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by