How to fix the coefficients values using the fitnlm() function
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Linear Predictive Coding in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!