Fitting a sigmoid curve with limited data

6 次查看(过去 30 天)
Hi, I'm a undergrad student and a complete beginner with MatLab. I am trying to obtain a dissociation constant through curvefitting my data. The problem is I only have data points on one side of the inflection point: I have : (90*10^-6, 60*10^-6, 40*10^-6, 25*10^-6, 10*10^-6, 7.5*10^-6) and (1, 1.120694521, 1.3852991, 1.434082877, 1.790047873 , 1.899364214) with an inflection point expected to be around 1-2*10^-6.
Is it possible to get a sigmoid curve with this limited data, because I only get linear or quadratic curves? Or can I perhaps use an estimate of some other values and have my actual data weigh stronger in the curvefit?
Thanks for your help,
Mark

回答(1 个)

the cyclist
the cyclist 2012-6-11
If you have the Statistics Toolbox, one possibility would be to use the nlinfit() function, and choose a sigmoid functional form. I have included a simple example of the use of that function (not using a sigmoid), which might help you get started. You'd need to replace my made-up data with your real data, and replace my "f" definition with your functional form.
% Here is an example of using nlinfit(). For simplicity, none of
% of the fitted parameters are actually nonlinear!
% Define the data to be fit
x=(0:1:10)'; % Explanatory variable
y = 5 + 3*x + 7*x.^2; % Response variable (if response were perfect)
y = y + 20*randn((size(x)));% Add some noise to response variable
% Define function that will be used to fit data
% (F is a vector of fitting parameters)
f = @(F,x) F(1) + F(2).*x + F(3).*x.^2;
F_fitted = nlinfit(x,y,f,[1 1 1]);
% Display fitted coefficients
disp(['F = ',num2str(F_fitted)])
% Plot the data and fit
figure(1)
plot(x,y,'*',x,f(F_fitted,x),'g');
legend('data','fit')
  3 个评论
Ryan
Ryan 2012-6-11
As far as the unexpected Matlab operator is concerned, it is most likely due to the ".+". The '.' operator before a mathematical operator promps Matlab to do element wise arithmetic. For example, say I have two vectors, A and B. Multiplying C = A*B will result in a matrix C, but using C = A.*B I will get a new vector the size of A and B where the C(1,1) = A(1,1)*B(1,1) and C(5,6) = A(5,6)*B(5,6), etc.
mark wentink
mark wentink 2012-6-11
thanks, it accepts my functional form now. Only one thing, what do I need to change to add F(4) in the functional form? I get an error "Attempted to access F(4); index out of bounds because numel(F)=3."

请先登录,再进行评论。

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by