[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Tweety
Subject: fminsearch
Date: Sun, 18 Dec 2016 19:28:43 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1


I have measured data (attached) to which I want to fit the sum of two
exp-functions. Here is my code so far:

A = dlmread('output.txt');
alpha60 = A(:,1);
cv60 = A(:,2);
function f = exponential(coeff,alpha60,cv60)
a = coeff(1);
b = coeff(2);
c = coeff(3);
d = coeff(4);
g = coeff(5);
h = coeff(6);
i = coeff(7);
Y_fun60 = a + b.*e.^(-alpha60./c).^d + g.*e.^(-alpha60./h).^i;
f = sum ((Y_fun60 - cv60).^2);
options = optimset('TolFun',1e1, 'TolX', 1e1);
[cc fval] = fminsearch(@(c) exponential(c,alpha60,cv60),[10 625 30 -270
-65 60 -13],options)
fitted60 = cc(1) + cc(2).*e.^(-alpha60./cc(3)).^cc(4) +
plot(alpha60,cv60, alpha60,fitted60)

When I plot this, I find that the fit does not match the data nicely and
I am asking myself why. Is it the options that I picked? I played around
with a few different starting values and options such as MaxIter, but
could not see major improvements. Is it the code, the function to be

I am running Octave 3.8.1.

BTW: I also ran into an example how to use nlinfit so I thought maybe I
could use that instead. Octave tells me it is part of statistics
package, but I finally found nlinfit in the function reference of optim
package. Is that some kind of version mismatch? How can I install an
older version of statistics (e. g. from forge), which one would I need?

Thanks for your help,

Attachment: output.txt
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]