exponential fit base 10
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
sarel aharoni
el 6 de Mzo. de 2018
Comentada: John D'Errico
el 7 de Mzo. de 2018
hello, i want to fit a exponential function (base 10) to my data i tried use this code :
ft2 = fittype('a + b * 10^(-c*freq)','dependent',{'absol'},'independent',{'freq'},'coefficients',{'a','b','c'});
f2 = fit(freq,absol,ft2);
plot(f2,freq,absol);
but the fit I got was a const line. not a exponential one. any idea what my problem may be? thank.
0 comentarios
Respuesta aceptada
John D'Errico
el 6 de Mzo. de 2018
Editada: John D'Errico
el 6 de Mzo. de 2018
We don't see your data. Nor do we see the results of the fit. However the chances are very good that what you have are poor starting values. You have not provided any starting values. If you don't do so, then fit will use its own choice. With exponential functions in any form, arbitrary starting values are often a poor choice.
For example, suppose the starting value for c was 1. If the values in freq are at all large numbers, say on the order of 20 to 100, then we start out by raising 10^(-c*freq). But those numbers are all on the order of eps or far smaller. They are all essentially zero. Changing the value of c will not impact that. You still get effectively zero. Is this scenario likely? It sure as heck is likely. A variable named freq probably indicates something to do with frequencies. They won't necessarily be small numbers. They probably won't be negative, or zero.
There are other data related possibilities. One might be just crappy data, with really high noise, or possibly data corrupted by outliers. Without seeing your data, anything is just a wild guess on my part. But my best guess is just bad starting values.
In fact, there are some nice tricks to gain quite good starting values. (The one that really matters most is probably c, since if you have a good guess for c, then the others can be estimated quite well. But there are good ways to estimate c.) I can't help any more without your data though.
So if you want help (and won't show the data), then my advice is to provide something intelligent in the form of starting values. If you want better help, then my advice is to provide your data. (Best as a .mat file attachment to your question or to a comment.) Then I could show you clearly why fit got into trouble, as well as how you might make a better choice of starting values.
4 comentarios
John D'Errico
el 7 de Mzo. de 2018
There are some nice tricks to estimate pretty good starting values for a model like this. But usually you would have a good idea what the rate constant might be, or at least a rough guess. And the rate constant is what really matters in any problem like this.
Más respuestas (1)
Jos (10584)
el 6 de Mzo. de 2018
Your plot command is incorrect, it seems (f2 is the fit result, not an x-value). So, try this:
plot(freq, f2(freq), 'r-')
3 comentarios
Jos (10584)
el 6 de Mzo. de 2018
What is the output of fit?
I also think you might want to add a dot before the power symbol in the formula (matrix power vs element-wise power):
a + b * 10 .^ (-c * freq)
Ver también
Categorías
Más información sobre Smoothing 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!