Strike = 29;
AssetPrice = 30;
Sigma = .25;
Rates = 0.05;
Settle = datenum('01-Jan-2008');
Maturity = datenum('01-May-2008');
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, ...
'EndDates',Maturity, 'Rates', Rates, 'Compounding', -1,'Basis',1);
DividendType = {'continuous';'continuous'};
DividendAmounts = [0.05; 0.045];
ExDividendDates = {NaN;NaN};
StockSpec = stockspec(Sigma, AssetPrice, DividendType, DividendAmounts);
OptSpec = {'call'; 'put'};
OptionPrice = optstockbybls(RateSpec, StockSpec, Settle, Maturity, OptSpec, Strike);
ImpvVol1 = impvbybls(RateSpec, StockSpec, Settle, Maturity, OptSpec, ...
Strike, OptionPrice)
ImpvVol2 = blsimpv(AssetPrice, Strike, Rates, ...
yearfrac(Settle,Maturity,1), OptionPrice, 'Class', OptSpec,'Yield',DividendAmounts)
ImpvVol1 =
0.250000000000000
0.250000000000000
ImpvVol2 =
0.250000000000000
0.250000000000000
Best Answer