File Exchange

image thumbnail


version (4.11 KB) by R P
Optimization of parameters of the sigmoid function


Updated 30 Mar 2016

View Version History

View License

Optimization of parameters of the sigmoid function


that is the same that
[param]=sigm_fit(x,y,[],[],[]) % no fixed_params, automatic initial_params

[param]=sigm_fit(x,y,fixed_params) % automatic initial_params
[param]=sigm_fit(x,y,[],initial_params) % use it when the estimation is poor

param = [min, max, x50, slope]

if fixed_params=[NaN, NaN , NaN , NaN] % or fixed_params=[]
optimization of "min", "max", "x50" and "slope" (default)

if fixed_params=[0, 1 , NaN , NaN]
optimization of x50 and slope of a sigmoid of ranging from 0 to 1

Additional information in the second output, STAT

%% generate data vectors (x and y)
fsigm = @(param,xval) param(1)+(param(2)-param(1))./(1+10.^((param(3)-xval)*param(4)))
param=[0 1 5 1]; % "min", "max", "x50", "slope"
y=fsigm(param,x) + 0.1*randn(size(x));

%% standard parameter estimation

%% parameter estimation with forced 0.5 fixed min
[estimated_params]=sigm_fit(x,y,[0.5 NaN NaN NaN])

%% parameter estimation without plotting

Cite As

R P (2021). sigm_fit (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (25)

Nicola Rossi

Works perfectly and the instructions are clear.

Jie Wang

Patrick Palmerini

Sebastian Musslick

Oded Scharf

Tatiana Mello

Swati Jain

eva zita patai

Jochem van Kempen

Great function!

Bram Mast

Simon Cropper

GDMFSOB Bloody brilliant! Thank you.

Sam Garrard


RJ Ellis

Works right out of the box. Thanks!

Daniel de Malmazet

Arturo Moncada-Torres

Majken Nielsen

Stefanie Heba


Works as expected!

Andrea Ballabeni

Simple and effective. Similarly to polyfit-polyval, it would be great to include the related sigm_val function, to evaluate the generated sigmoidal curve.

noam josef

tried using the function with my data and the givven example but in both recieved "Undefined function 'sigm_fit' for input arguments of type

any thughts about it?


Earl Vickers

This requires a minmax() function - which toolbox is that in?

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Sine function fit

Inspired: sigmoid, sigm_fit_val(param,x)

Community Treasure Hunt

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

Start Hunting!