MATLAB: Fit Powerlaw to Data

curve fitting

Hi all!
I need to fit following Power Law to some experimental data.
y = C(B+x)^n
The data I have is as the following:
STRESS = [0.574, 367.364, 449.112, 531.087, 596.241, 649.097, 695.038, 737.173, 815.008];
STRAIN = [2.8746e-04, 0.00063, 0.0459, 0.0901, 0.1320, 0.1725, 0.2132, 0.2557, 0.3579];
The variables are x and y are STRAIN and STRESS respectively, and I would like estimates for C, B and n.
I'm not sure how to use the fitting tool for this kind of specific model.
Any ideas or suggestions would be greatly appreciated!
Thank you very much!

Best Answer

Try this:
STRESS = [0.574, 367.364, 449.112, 531.087, 596.241, 649.097, 695.038, 737.173, 815.008];
STRAIN = [2.8746e-04, 0.00063, 0.0459, 0.0901, 0.1320, 0.1725, 0.2132, 0.2557, 0.3579];
yfcn = @(b,x) b(1).*(b(2)+x).^b(3);
B0 = [1E-6; 100; 2];
B = fminsearch(@(b) norm(STRAIN - yfcn(b,STRESS)), B0);
xv = linspace(min(STRESS), max(STRESS), 50);
yv = yfcn(B,xv);
figure
plot(STRESS, STRAIN, 'pg')
hold on
plot(xv, abs(yv), '-r')
hold off
grid
text(150, 0.27, sprintf('y = %.3E \\cdot (%.3f + x)^{%.3f}', B))
xlabel('STRESS')
ylabel('STRAIN')
Experiment to get different results.
EDIT (6 Dec 2019 at 17:50)
Added plot image:
1Fit Powerlaw to Data - 2019 12 06.png
Related Question