File Exchange

## sigm_fit

version 1.5.0.0 (4.11 KB) by R P

### R P (view profile)

Optimization of parameters of the sigmoid function

Updated 30 Mar 2016

Optimization of parameters of the sigmoid function

Syntax:
[param]=sigm_fit(x,y)

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]=sigm_fit(x,y,fixed_params,initial_params,plot_flag)

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
[param,stat]=sigm_fit(x,y,fixed_params,initial_params,plot_flag)

Example:
%% 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"
x=0:0.1:10;
y=fsigm(param,x) + 0.1*randn(size(x));

%% standard parameter estimation
[estimated_params]=sigm_fit(x,y)

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

%% parameter estimation without plotting
[estimated_params]=sigm_fit(x,y,[],[],0)

### Cite As

R P (2020). sigm_fit (https://www.mathworks.com/matlabcentral/fileexchange/42641-sigm_fit), MATLAB Central File Exchange. Retrieved .

Jie Wang

### Jie Wang (view profile)

Patrick Palmerini

### Patrick Palmerini (view profile)

Sebastian Musslick

Oded Scharf

Tatiana Mello

Swati Jain

eva zita patai

### eva zita patai (view profile)

Gabriel Sales Lins Rodrigues

### Gabriel Sales Lins Rodrigues (view profile)

Jochem van Kempen

Great function!

Bram Mast

Simon Cropper

### Simon Cropper (view profile)

GDMFSOB Bloody brilliant! Thank you.

Sam Garrard

Zoe

RJ Ellis

### RJ Ellis (view profile)

Works right out of the box. Thanks!

Daniel de Malmazet

### Daniel de Malmazet (view profile)

José Luis Molina Borboa

Majken Nielsen

Stefanie Heba

Reza

### Reza (view profile)

Works as expected!

Andrea Ballabeni

### Andrea Ballabeni (view profile)

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

### noam josef (view profile)

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

Yongshen

Earl Vickers

### Earl Vickers (view profile)

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