Fitting to an exponential function from row datas

조회 수: 1(최근 30일)
friet
friet 2017년 6월 4일
답변: Star Strider 2017년 6월 4일
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];

Community Treasure Hunt

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

Start Hunting!

Translated by