Fitting to an exponential function from row datas

3 次查看(过去 30 天)
I have a function y dependent on t. I want to fit it to a function of y=a*exp(-b/t) and determine the variables "a" and "b". I write the code below, however, it didn't converge. Any help is appreciated.
Thanks GH
clear all
clc
Data=[300.0092 2.2742e-16
331.0053 2.1617e-15
335.0210 3.0675e-15
361.2484 4.3307e-14];
t = Data(:,1);
y = Data(:,2);
plot(t,y,'ro')
title('Data points')
F = @(x,xdata)x(1)*exp(-x(2)*xdata);
x0 = [10^-16 0.001];
[x,resnorm,~,exitflag,output] = lsqcurvefit(F,x0,t,y)
hold on
plot(t,F(x,t))
hold off

回答(1 个)

Star Strider
Star Strider 2017-6-4
It appears to with:
x0 = [1E-15 -0.1];

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by