Curve fitting data from a script model

Hello!!
I have some data that I need to fit. And I have a model with one variable that fits, but I would like Matlab to calculate the fit instead of doing it manually. But when I try to use fit, the fitted curve is far off... I hope you can help me!
The model calculates f for a given x and Mdot. f is also a [6x1]
x = [6x1];
FUN = fittype('model(x,Mdot)');
fo = fitoptions(FUN);
fo.StartPoint = [0.08*Msun/yr];
fit1 = fit(x,f,FUN)
plot(fit1,x,f)

Respuestas (1)

Star Strider
Star Strider el 1 de Dic. de 2016

0 votos

We don’t have your data or your model. You may need one more parameter to fit your function to your data.

5 comentarios

Maria Munoz
Maria Munoz el 1 de Dic. de 2016
When I plot the model function and the data, I get a good fit... And I only use the x and Mdot. I just don't understand why it doesn't work.
Star Strider
Star Strider el 1 de Dic. de 2016
We don’t know why it doesn’t work either, because we don’t have your data or your model function to experiment with to see what the problem is.
Maria Munoz
Maria Munoz el 1 de Dic. de 2016
Sorry, of course! I have a lot of data, but this is one sample of what I need to fit:
f = [1.51526047923861e-11; 1.39617501447364e-11; 1.99836674688087e-11; 1.69039270148481e-11; 1.91708428700862e-11; 1.91244758590242e-11]
x = [0.547965008022000e+15; 0.684005989759400e+15; 0.866866521626200e+15; 1.15498943410500e+15; 1.33682957397900e+15;1.55703596918000e+15]
Thank you so much for your time!! :)
Maria Munoz
Maria Munoz el 1 de Dic. de 2016
The model is a bit difficult to share, because there are a lot of constants and it calls other functions... But if you have any idea of why it doesn't work, something I could try, I really don't know... I would be forever thankful!
Star Strider
Star Strider el 1 de Dic. de 2016
I would like to help, but without your model and an explanation of it, and especially without knowing (and preferably having a mathematical model of) the process that created your data, there is simply no way to go further.
I will delete my Answer in a few minutes.

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 1 de Dic. de 2016

Comentada:

el 1 de Dic. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by