Main Content


Fit Svensson model to bond market data



outCurve = fitSvensson(Settle,Instruments,CleanPrice) fits a Svensson model to bond data.


collapse all

Define the bond data and use fininstrument to create FixedBond instrument objects.

 Settle = datetime(2017,9,15);
  Maturity = [datetime(2019,9,15);datetime(2021,9,15);...
  CleanPrice = [100.1;100.1;100.8;96.6;103.3;96.3];
  CouponRate = [0.0400;0.0425;0.0450;0.0400;0.0500;0.0425];
nInst = numel(CouponRate);
Bonds(nInst,1) = fininstrument.FinInstrument;
for ii=1:nInst
    Bonds(ii) = fininstrument("FixedBond",'Maturity',Maturity(ii),...

Use fitSvensson to create a parametercurve object.

SvenModel = fitSvensson(Settle,Bonds,CleanPrice)
Solver stopped prematurely.

lsqnonlin stopped because it exceeded the function evaluation limit,
options.MaxFunctionEvaluations = 6.000000e+02.
SvenModel = 
  parametercurve with properties:

              Type: "zero"
            Settle: 15-Sep-2017
       Compounding: -1
             Basis: 0
    FunctionHandle: @(t)fitF(Params,t)
        Parameters: [0.6861 -38.1136 42.9188 -1.8840 0.3510 1.9195]

Input Arguments

collapse all

Settlement date, specified as a scalar datetime, serial date number, date character vector, or date string.

Data Types: double | char | string | datetime

Bond instrument objects, specified as an array of bond instrument objects.

Data Types: object

Observed market prices, specified as a vector.

Data Types: double

Output Arguments

collapse all

Fitted Svensson model, returned as a parametercurve object.

Introduced in R2020a