Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

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?

share|improve this answer
up vote 0 down vote accepted

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

share|improve this answer
Is this the answer? – chrisaycock May 27 '13 at 15:07
Question was also asked on Stack Overflow, and this was the answer accepted. stackoverflow.com/questions/16764495/… – Phil H May 31 '13 at 13:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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