%% Price a Swaption with a Receiving and Paying Leg Using the Normal Model
% Create a RateSpec.

Rate = 0.06;
Compounding  = -1;
ValuationDate = 'Jan-1-2010';
EndDates =   'Jan-1-2020'; 
Basis = 1; 
RateSpec = intenvset('ValuationDate', ValuationDate,'StartDates', ValuationDate, ...
'EndDates', EndDates, 'Rates', Rate, 'Compounding', Compounding, 'Basis', Basis);

%
% Define the swaption.

ExerciseDate = datenum('20-Jan-2021');
Maturity = datenum('20-Jan-2026');
Settle = 'Jan-1-2010';
OptSpec = 'call';
Strike = .09;
NormalVol = .03;
Reset = [1 4];  % 1st column represents receiving leg, 2nd column represents paying leg
Basis = [1 7];  % 1st column represents receiving leg, 2nd column represents paying leg

%
% Price with Normal volatility.

Price_Normal = swaptionbynormal(RateSpec,OptSpec,Strike,Settle,ExerciseDate,Maturity,NormalVol,'Reset',Reset,'Basis',Basis)

% Copyright 2012 The MathWorks, Inc.