フィルターのクリア

How can I use isqurvefit or fminsearch to have my coefficient of the function?

1 回表示 (過去 30 日間)
Hi everyone,
I have the following function, how can I get the value of A,B and n by curve fitting, I tried but I was not successful.
Initial guesses for:
A=0.0005; B=0.14; n=2
y=[7.754e-05 6.825e-05 6.2156e-05 5.9374e-05 5.803e-05 5.3958e-05 5.1747e-05 4.9142e-05 8.2671e-05 7.7143e-05];
x=[0.592 0.652 0.693 0.726 0.751 0.772 0.790 0.820 0.452 0.525];
y=A+B*(x)^n;
Thanks in advance

採用された回答

Star Strider
Star Strider 2015 年 4 月 23 日
This works with lsqcurvefit:
y=[7.754e-05 6.825e-05 6.2156e-05 5.9374e-05 5.803e-05 5.3958e-05 5.1747e-05 4.9142e-05 8.2671e-05 7.7143e-05];
x=[0.592 0.652 0.693 0.726 0.751 0.772 0.790 0.820 0.452 0.525];
[x,ix] = sort(x);
y = y(ix);
% MAPPING: b(1) = A, b(2) = B, b(3) = n
f = @(b,x) b(1) + b(2).*x.^b(3);
B0 = [5E-4, 0.14, 2];
Prms = lsqcurvefit(f, B0, x, y);
figure(1)
plot(x, y, 'bp')
hold on
plot(x, f(Prms,x), '-r')
hold off
grid

その他の回答 (0 件)

カテゴリ

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