I'm trying to price an interest rate swap and would like to change the default coupon payment frequency from 1 a year to 2 or 4 a year. I'm using

Price = swapbyzero(RateSpec, LegRate, i, Maturity, 'Principal', Principal); 

and tried

Price = swapbyzero(RateSpec, LegRate, i, Maturity, 'Principal', Principal,'Period',2); 

where 'Period' is a valid option when pricing bond using


I'm using matlab 2013a


2 Answers 2


I don't know what is supported by MatLab (I use Java to do such stuff :-).

But in case you do not find a solution from the swapbyzero function you mentioned I can suggest a workaround:

  • Value a swap with the annual fix frequence.

Given that it is a payer swap (pays the fixed leg), correct the value by:

  • Substract the value of an annual fix coupon bond and
  • Add the value of the desired frequence fix coupon bond.

PS: Note that the MatLab function is likely not appropriate to value a swap in a "realistic" way, since it looks like multi-curve (OIS discounting) is not considered here (I wonder if term structure is considered?), see also Rationale for OIS discounting for collateralized derivatives?


Name-Value pair option 'LegReset' [n n] where n is the frequency


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.