File Exchange

image thumbnail

Evaluate Nelson-Siegel function

version (1.86 KB) by Dimitri Shvorob
(or fit one to a yield curve)


Updated 04 Apr 2016

View License

Functions NELSONFUN and NELSONFIT evaluate and fit (with non-linear least-squares) the Nelson-Siegel function, a popular yield-curve approximation device.

Cite As

Dimitri Shvorob (2021). Evaluate Nelson-Siegel function (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (12)


xiaoshi zhu

yi huo

I have been read the Nelson Siegel Model article,and I think I can realize the model,and I attempte to write program to fit it


thx in advance

Tornike Mosiashvili

Hello, Could you please let me know how the nelsonsse and lsbetas work?

Thanks in advance.

Yirong Zhu



is there something wrong in the code?
I cannot run it.
function[f] = nelsonsse(tau)
[b,f] = lsbetas(tau); %#ok

function[b,varargout] = lsbetas(tau)
i = x(:)/tau;

is this part has some mistakes?

rishad schaefer

Great work...
Just a question: Do you know what scilab function ( used with wich parameters) could replace your fminbnd in order to get the fit.
I just can t get the propper algorithm on scilab...

Antonio Juambeltz

I expect this is a very interesting point for us in the Ministry of Finance in Uruguay.

Wu-Fu Han

Dimitri Shvorob

Note NELSONFIT's default (and easy-to-change) behavior of searching for tau in (0,10) and adjust the range if measuring time in days or months. (The Nelson-Sielgel function is homogeneous of degree 0 in x/tau).

MATLAB Release Compatibility
Created with R2006a
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!