How to fix the coefficients values using the fitnlm() function
이전 댓글 표시
Hi all,
I am trying to use non linear regression fit using the fitnlm function. Is there a way to fix a specific
coefficient to a known value? in this specific case I would like to fix b(2) to 50.
Thank you in advance for your help.
I report here my code
x = data (:,1);
y = data (:,2);
plot (x, y, 'o')
hold on
%----- Model function for 1:1 binding -------
b0 = [0.06; 50; 0.5];
modelfun = @(b,x)b(1)*(b(2)+x+b(3)-sqrt((b(2)+x+b(3)).^2-4*b(2)*x))./(2*b(2));
%options for fitnlm
options = statset('Display','iter','TolFun',1e-10)
modelFit=fitnlm(x,y,modelfun, b0,'Options',options)
results=table2array(modelFit.Coefficients)
plot(x, modelfun(results(:,1), x))
hold off
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Linear Predictive Coding에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!