0

I have two arrays:

E= [6656400;
    13322500;
    19980900;
    26625600;
    33292900;
    39942400;
    46648900;
    53290000]

and

J=[0.0000000021;
    0.0000000047;
    0.0000000128;
    0.0000000201;
    0.0000000659;
    0.0000000748;
    0.0000001143;
    0.0000001397]

I want to find the appropriate curve fitting for the above data by applying this equation:

J=A0.*(298).^2.*exp(-(W-((((1.6e-19)^3)/(4*pi*2.3*8.854e-12))^0.5).*E.^0.5)./((1.38e-23).*298))

I want to select the starting value of W from 1e-19

I have tried the curve fitting tools but it is not helping me to solve it!

Then, I selected some random values of A0=1.2e9 and W=2.243e-19, it gave me a better results. But I want to find the right values by using the code (not the curve fitting Apps)

Can you help me please?

  • You can use this post for inspiration: http://stackoverflow.com/questions/28112559/exponential-curve-fit-matlab/28113190#28113190 - Essentially, you should take the `log` of the equation so that it becomes linear in `log` space, then calculate the coefficients by linear regression. – rayryeng Jan 29 '15 at 19:08

1 Answers1

1

A quick (and potentially easy) solution method would be to pose the curve fit as a minimization problem.

Define a correlation function that takes the fit parameters as an argument:

% x(1) == A0; x(2) == W
Jfunc = @(x) x(1).*(298).^2.*exp(-(x(2)-((((1.6e-19)^3)/(4*pi*2.3*8.854e-12))^0.5).*E.^0.5)./((1.38e-23).*298));

Then a objective function to minimize. Since you have data J we'll minimize the sum-of-squares of the difference between the data and the correlation:

Objective = @(x) sum((Jfunc(x) - J).^2);

And then attempt to minimize the objective using fminsearch:

x0  = [1.2E9;2.243E-19];
sol = fminsearch(Objective,x0);

I used the guesses you gave. For nonlinear solutions, a good first guess is often important for convergence.

If you have the Optimization Toolbox, you can also try lsqcurvefit or lsqnonlin (fminsearch is vanilla MATLAB).

TroyHaskin
  • 8,361
  • 3
  • 22
  • 22