MATLAB: Implied volatility with multiple discrete dividends

Financial Instruments Toolbox

How can I calculate implied (Black) volatility in MATLAB given: spot/forward price, multiple DISCRETE dividends, EU and US type option. In case of US, there is "impvbyrgw()", however, this only works for one dividend.
Is there any function that can handle multiple discrete dividends?

Best Answer

This can be done by using some of our built-in option pricing functionality along with calling "fzero". Attached is an example that uses "optstockbyfd" along with "fzero" to compute the implied volatility for an option with American-style exercise and multiple discrete dividends.