フィルターのクリア

How can I do the best fit of a power function with my original data

2 ビュー (過去 30 日間)
Ahmed Abdalazeez
Ahmed Abdalazeez 2018 年 6 月 20 日
コメント済み: Ahmed Abdalazeez 2018 年 6 月 21 日
I have two variables (x,y). we found by eye that y = x^1/2.33, but it is not perfect for what I want and also when I test the correlation it gives me ONE but I think it should not be one because there is a variance value 0.0113. I can use the 'basic fitting' but there is no option of the power function. Thanks in advance

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 6 月 20 日
You can use lsqcurvefit() for least square curve fitting. For example
% sample data
x = 0:10;
y = x.^0.33 + 0.2*rand(size(x));
f = @(x, xdata) xdata.^x(1); % function to fit, 'x' will be estimated
solution = lsqcurvefit(f, 0, x, y)
  3 件のコメント
Ameer Hamza
Ameer Hamza 2018 年 6 月 20 日
solution is the estimated value of the exponent. you need to use (x,y) values from your own dataset.
Ahmed Abdalazeez
Ahmed Abdalazeez 2018 年 6 月 21 日
OK, Thank you so much

サインインしてコメントする。

その他の回答 (1 件)

Torsten
Torsten 2018 年 6 月 20 日
xdata = ...;
ydata = ...;
a0 = 1/2.33;
fun = @(a)sum((ydata-xdata.^a).*xdata.^a.*log(xdata));
a = fzero(fun,a0)
Best wishes
Torsten.

カテゴリ

Help Center および File ExchangeLeast Squares についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by