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

17 次查看(过去 30 天)
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]

采纳的回答

Torsten
Torsten 2018-10-16
编辑:Torsten 2018-10-16
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

更多回答(0 个)

类别

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

标签

产品


版本

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by