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

15 ビュー (過去 30 日間)
Vahram Voskerchyan
Vahram Voskerchyan 2021 年 9 月 20 日
コメント済み: Alex Sha 2021 年 9 月 20 日
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 Center および File ExchangeGet 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