image thumbnail


version (5.32 KB) by Steven Shimizu
Fits data to linear, Langmuir, Freundlich, Sips or Toth isotherms


Updated 18 Jun 2014

View License

[xfit,yfit,isothermParams] = fitAdsorptionIsotherm(x,y,isotherm,ploton,xfit)

This function fits several adsorption isotherms to adsorption data (e.g.
moles adsorbed vs pressure). The function also optionally plots the data and fitted isotherm. The units of parameters are dependent on the
units provided by the x and y values.

For example, for the Langmuir isotherm, if x is in units of bar, and
y is in units of g/mL, then K has units of 1/bar, and N0 has units
of g/mL.

-x: The x-coordinate for the isotherm (e.g. pressure, relative
pressure, etc.)
-y: The y-coordinate for the isotherm (e.g. adsorbed moles, mass
adsorbed, etc.)
-isotherm: A string input indicating which isotherm to fit to the
data. Supported values for isotherm:
-ploton: Optional flag to indicate whether the data and fitted
isotherm should be plotted (0 = no plot, 1 = plot).
-xfit: Optional input; The program calculates the value of the fitted
adsorption isotherm for each value of vector xfit fitted isotherm
adsorbed amount. If unspecified, the program returns yfit vector of
length 100 across the range min(x) and max(x).

-xfit: The values of x used to calculate the fitted isotherm values
-yfit: The calculated values of the fitted adsorption isotherm
corresponding to values of xfit
-isothermParams: A structure with named parameters corresponding to
the fitted parameters for the adsorption isotherm. P and N represent
the x and y-coordinates of the adsorption isotherm.
-'linear': N = K*P ----> {'K'}
-'langmuir': N = N0*K*P/(1+K*P) ----> {'K','N0'}
-'freundlich': N = K*P^(1/m) ----> {'K','m'}
-'sips': N = N0*K*P^(1/m)/(1+K*P^(1/m)) ----> {'K','N0','m'}
-'toth': N = N0*P/(1/K + P^t)^(1/t) ----> {'K','N0','t'}

For example, the parameters can be accessed like so:
>> K_fitted = isothermParams.K;
>> mfit = isothermParams.m;

Example Usage:
x =
y =

[xfit,yfit,isothermParams] = fitAdsorptionIsotherm(x,y,'langmuir',1);

Cite As

Steven Shimizu (2022). fitAdsorptionIsotherm (, MATLAB Central File Exchange. Retrieved .

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

Community Treasure Hunt

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

Start Hunting!