Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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

Akzeptierte Antwort

Star Strider
Star Strider am 23 Apr. 2015
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

Weitere Antworten (0)

Kategorien

Mehr zu Least Squares finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by