Help in curve fitting tool box

2 visualizaciones (últimos 30 días)
ruban ramalingam
ruban ramalingam el 4 de Mzo. de 2019
Comentada: John D'Errico el 4 de Mzo. de 2019
tr=[400 600 1200];
>> Sigma=[250 200 175];
>> cftool
Want to fit the following custom equation
tr= 1/B*(1+phi)*(sigma^chi)
and to determine the optimised parameters B, phi and chi..
I am getting the error shown in the following attached file...
I think I am doing some syntax mistake??
Please correct me..
I will be grateful for your help

Respuesta aceptada

Stephan
Stephan el 4 de Mzo. de 2019
Hi,
replace 'x' by 'Sigma' in the line above your custom equation:
y = f(x) --> y = f(Sigma)
Best regards
Stephan
  1 comentario
John D'Errico
John D'Errico el 4 de Mzo. de 2019
This answer does solve the immediate problem. But it still misses the point that the model itself is essentially unfittable.

Iniciar sesión para comentar.

Más respuestas (1)

John D'Errico
John D'Errico el 4 de Mzo. de 2019
Without even immediately addressing the error you got, first, it is a really bad idea trying to fit a 3 parameter model, using only 3 data points. At best, this leaves an exact fit. If one exists.
However, what you have is worse. You only have effectively 2 (TWO) parameters, yet you have 3 degrees of flexibility. That is, B and phi enter into the model not as independent pieces of information, but forever linked in a way that will never allow you to estimate both of them. For example, suppose you did find a solution. I'll call it [B0,phi0,chi0].
You can then find a completely different solution that is exactly as good. In fact, you can find infinitely many completely different solutions, all of which are equivalent. That is, suppose you chose any multiple of phi0? In fact, literally any transformation of phi0? For example, suppose you picked some value
phi1 = k*phi0
You can arbitrarily pick ANY value for k. Then we can now change B in such away that a new solution exists that is equally as good.
B1 = B*(1 + k*phi0)/(1+phi0)
A quick check will let you see that the new solution [B1,phi1,chi] is mathematically identical to the old solution. No better, no worse. As such, the curve fitting toolbox cannot uniquely estimate those three distinct parameters. At best, you can fit a TWO parameter model, of the form
tr = A*sigma^chi
So how might we do this? Even accepting that this is data I would not be happy using to fit ANY model?
tr=[400 600 1200];
Sigma=[250 200 175];
First, plot it.
plot(Sigma,tr,'o-')
untitled.jpg
So, if a fit exists, then my expectatino is chi must be negative.
ft = fittype('power1')
ft =
General model Power1:
ft(a,b,x) = a*x^b
mdl = fit(Sigma',tr',ft)
mdl =
General model Power1:
mdl(x) = a*x^b
Coefficients (with 95% confidence bounds):
a = 2.427e+11 (-1.844e+13, 1.893e+13)
b = -3.71 (-18.47, 11.05)
plot(mdl)
hold on
plot(Sigma,tr,'o-')
untitled.jpg
So the power law model exhibits significant lack of fit, IMHO. As fits go, pure crap. You can see the confidence limits are pretty wide. fit is not happy with the result either.
Given those estimated parameters, we can now recover any of infinitely many choices for B and phi. Pick your favorite. For example, we might pick phi = 0. then B is easy to compute, as
B = 1/mdl.a
B =
4.121e-12
Or, what if we set B = 1? Just as arbitrary. Then phi is given as
format long g
mdl.a - 1
ans =
242659099053.228
Or feel free to pick your favorite numbers. I like B = 17, myself. Then, since we have the relationship:
(1+phi)/B = a
we can do this:
B = 17;
phi = mdl.a*B - 1
phi =
4125204683920.88
So, I'm sorry, but as models go, I'm not impressed with this one.
As for what you did wrong in the gui interface, it looks like you specified the model as
1/B*(1+phi)*(sigma^chi)
in the gui. But then you told it that x was the independent variable in the problem, and that y was the dependent variable. Where did you tell it to interpret Sigma as x? In fact, the error message that you show indicates that it is confused about x.
  3 comentarios
ruban ramalingam
ruban ramalingam el 4 de Mzo. de 2019
@John..sir Any iterative process is needed...
John D'Errico
John D'Errico el 4 de Mzo. de 2019
I don't think you understand. This model is ambiguous. You cannot untangle B and phi, even if you have a million points.
tr=[100 150 200 300 350];
Sigma=[250 200 175 150 125];
mdl = fit(Sigma',tr','power1')
mdl =
General model Power1:
mdl(x) = a*x^b
Coefficients (with 95% confidence bounds):
a = 1.726e+06 (-4.469e+06, 7.921e+06)
b = -1.752 (-2.47, -1.034)
plot(mdl)
untitled.jpg
Out of 5 points, it looks like the second one is a bit of an outlier.
As far as minimal R^2, you actually want the R^2 parameter to be near 1. So perhaps you are talking about a minimum sum of squares of the residuals, or RMSE, etc.
However, given that model and that data, that looks reasonable as a fit. Regardless, you still cannot resolve the values of B and phi. You are left with the relationship:
(1+phi)/B = a
We can estimate a in the power law model. But given that, you can NEVER know what values B and phi would take on. Sorry, but that is impossible. At best, you can pick some value for one of those numbers, and then use the expression I show to get the value of the other. And that is the best you can do. This is not a question of ANY iterative process. I don't care how much you want it to happen. Mathematics is simple in this respect, but mathematics is also unyielding, and your wishes won't change a thing.
phi = 1;
B = (1+phi)/mdl.a
B =
1.15875703506007e-06

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by