Filter löschen
Filter löschen

How to do a Four Parameters logistic regression fit without the Curve fitting toolbox?

29 Ansichten (letzte 30 Tage)
I have an 'X' and 'Y' vector (see below) which I want to fit to a Four Parameters logistic model: Y=D+(A-D)/(1+(X/C)^B), but I don't have access to any Matlab toolboxes. How can I do this so I end up with the A,B,C and D parameters?
X=[0.000; 0.012; 0.023; 0.047; 0.094; 0.188; 0.375; 0.750; 1.500; 3.000; 6.000; 12.000]
Y=[0.034; 0.018; 0.023; 0.036; 0.051; 0.065; 0.077; 0.128; 0.224; 0.399; 0.660; 1.0350]

Akzeptierte Antwort

Torsten
Torsten am 16 Okt. 2018
Bearbeitet: Torsten am 16 Okt. 2018
function main
X = [0.000; 0.012; 0.023; 0.047; 0.094; 0.188; 0.375; 0.750; 1.500; 3.000; 6.000; 12.000];
Y = [0.034; 0.018; 0.023; 0.036; 0.051; 0.065; 0.077; 0.128; 0.224; 0.399; 0.660; 1.0350];
p0 = [2 1 1 1]; %Set initial guess for parameter vector
p = fminsearch(@(p)fun(p,X,Y),p0); % Call optimizer for fitting
Ysim = p(4)+(p(1)-p(4))./(1+(X/p(3)).^p(2)); % evaluate final logistic function at measurement points
plot(X,Y,X,Ysim) %plot measured and fitted values
end
function obj = fun(p,X,Y)
Ysim = p(4)+(p(1)-p(4))./(1+(X/p(3)).^p(2)) % evaluate logistic function at measurement points
obj = (Y-Ysim).'*(Y-Ysim) % calculate sum of squared differences between measured and fitted values
end

Weitere Antworten (0)

Kategorien

Mehr zu Least Squares finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by