-1

I am trying to solve this example in MATLAB but I can't get the right answer.

enter image description here

i use this code

clear all;clc;
x=[4 2.25 1.45 1.0 0.65 0.25 0.006];
y=[ 0.398 0.298 0.238 0.198 0.158 0.098 0.048];
n=length(x);
sumx=sum(log10(x));
sumy=sum(log10(y));
sum2x=sum(log10(x));
sum3x=sum(log10(y));
sum4x=sum(log10(x.*y));
sumxy=sum(log10(x.^2));
sumx2y=sum(log10((x.^2) .*y)); 
m1=[n sumx sum2x;sumx sum2x sum3x;sum2x sum3x sum4x]
m2=[sumy;sumxy;sumx2y]
m3=inv(m1)*m2;
plot(x,y)
Cris Luengo
  • 55,762
  • 10
  • 62
  • 120

1 Answers1

0

Isn't this just to make a power fit of the data (-r and C) to obtain the constants n and k?

If so, you can just use the Curve Fitting app in MATLAB to do so:

General model Power1:
     f(x) = a*x^b
Coefficients (with 95% confidence bounds):
       a =      0.2003  (0.1826, 0.2179)
       b =      0.4889  (0.4028, 0.5751)

Goodness of fit:
  SSE: 0.001052
  R-square: 0.9877
  Adjusted R-square: 0.9852
  RMSE: 0.0145
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
stinky
  • 1