How can I make an exponential fit using two points of my data.

19 次查看(过去 30 天)
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 个评论
Alex Sha
Alex Sha 2021-9-20
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

请先登录,再进行评论。

采纳的回答

the cyclist
the cyclist 2021-9-20
编辑:the cyclist 2021-9-20
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 个评论
Vahram Voskerchyan
Vahram Voskerchyan 2021-9-20
Thanks a lot for the answer, this worked for my case also. Can you elaborate a little bit what are these [1000 1 1 1 1 1 1 1] if possible?
the cyclist
the cyclist 2021-9-20
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).

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by