How to do exponential curve fitting like y=a*exp(-b/x)

30 visualizaciones (últimos 30 días)
Atiqur Rahman
Atiqur Rahman el 1 de Ag. de 2021
Comentada: Atiqur Rahman el 1 de Ag. de 2021
I can't linearization of this equation.y=a*exp(-b/x). I want to make the eqn like y=mx+c. Then find out the value of a and b by solving two matrix by matlab. Can anyone help me? Thanks in advance.

Respuesta aceptada

Matt J
Matt J el 1 de Ag. de 2021
If you make the change of variables u=log(y), c=log(a) and v=1/x, then your exponential equation becomes u=c-b*v which is linear in u and v. However, this is usually recommended only as a way of initializing an iterative fit. The latter you can do either with fit(), lsqcurvefit(), or some File Exchange options like fminspleas.
  4 comentarios
Matt J
Matt J el 1 de Ag. de 2021
You are quite welcome, but please Accept-click the answer if it helped you.

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 1 de Ag. de 2021
I would recommend using fitnlm() instead. It's pretty much just as easy and it probably gives you a better fit.
% Define the model as Y = a * exp(-b/x) + c
modelfun = @(b,x) b(1) * exp(-b(2) ./ x(:, 1)) + b(3);
% Now the next line is where the actual model computation is done.
mdl = fitnlm(tbl, modelfun, beta0);
% Now the model creation is done and the coefficients have been determined.
% Extract the coefficient values from the the model object.
% The actual coefficients are in the "Estimate" column of the "Coefficients" table that's part of the mode.
coefficients = mdl.Coefficients{:, 'Estimate'}
Full demo is attached.

Community Treasure Hunt

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

Start Hunting!

Translated by