How can I make an exponential fit using two points of my data.
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Vahram Voskerchyan
el 20 de Sept. de 2021
Comentada: Alex Sha
el 20 de Sept. de 2021
I have a data that I try to fit which and I get this plot using curve fitting tool box.
x = (length_wg0*10e5)'
y = T_forward_10nm
f = fit (x, y, 'exp1' )
plot (f, x, y)
set(gca, 'YDir','reverse')
but what I want to get is the curve that passes from the first point. Shown in the graph below.
How can I do it?
1 comentario
Alex Sha
el 20 de Sept. de 2021
if take your data as:
x=[0.253629,16.3269,31.0374,58.454,116.959,175.756,231.876,289.34];
y=1.0033,0.969485,0.959453,0.939367,0.00178676,0.00245301,0.00648837,0.00374009];
The fitting function may be taken as:
y=Vmax*x^n/(k^n+x^n)
by adding the constrained condition of passing first point, the results will be:
Root of Mean Square Error (RMSE): 0.0197683134500478
Sum of Squared Residual: 0.00312628973327472
Correlation Coef. (R): 0.999589835353114
R-Square: 0.999179838941266
Parameter Best Estimate
---------- -------------
vmax 1.00329999999224
n -12.6896697136722
k 72.238637792372
Respuesta aceptada
the cyclist
el 20 de Sept. de 2021
Editada: the cyclist
el 20 de Sept. de 2021
You can use the 'Weights' Name-Value pair, and heavily weight the first point. Here is a made-up example. Notice how f2 passes through the first point.
x = [0 20 40 60 100 120 140 160]';
y = [1 2 3 4 10 11 12 13]';
f1 = fit (x, y, 'exp1' );
f2 = fit (x, y, 'exp1', 'Weights',[1000 1 1 1 1 1 1 1] );
figure
plot (f1, x, y)
figure
plot (f2, x, y)
2 comentarios
the cyclist
el 20 de Sept. de 2021
I suggest you read the documentation for the fit function. Scroll down to "Input Arguments -- Name-Value Pair Arguments".
That is a vector of weights, indicating that the error in the first point should be weighted more heavily (by a factor of 1000) than all the other points (which are weighted equally).
Más respuestas (0)
Ver también
Categorías
Más información sobre 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!