How to do a Four Parameters logistic regression fit without the Curve fitting toolbox?
조회 수: 14 (최근 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]
댓글 수: 0
채택된 답변
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 Center 및 File Exchange에서 Least Squares에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!