# Implementing nonlinear optimization to find model free implied volatility using Matlab

I am trying to calculate model free implied volatility $\sigma_{MF}$ for a relative performance index using the following method:

$\sigma_{MF}^2=2\sum_{i} [\frac{C(T,K_{i})}{K_{i}^2} - \frac{max(0,F-K_{i})}{K_{i}^2}]\Delta K_{i}$, where $F=Ie^{(\frac{\sigma_{M}^2-\sigma_{S}^2+\sigma_{MF}^2}{2})T}$

The only unknown here is $\sigma_{MF}$.How can I implement this using Matlab? I am confused as to how I can use nonlinear optimization functions when the unknown $\sigma_{MF}$ is itself inside a loop.

-
This formula looks like the formula for VIX as the CBOE calculates it. Why do you have those $\sigma$ terms in the exponential for $F$? This is not standard ... maybe you do some secret magic there ... if this is not the case: what is this? If you just calculate VIX, then you don't need any solver ... for $F$ you could use cost-of-carry or the implied forward from put-call parity. – Richard Feb 15 '13 at 12:46

Write the equation as $\sigma_{MF} \to G(\sigma_{MF}) = 0$ (by subtracting $\sigma_{MF}^2$) and use a root finder. As how to solve $G(\sigma_{MF}) = 0$ in MatLab check the MatLab documentation (see e.g. "solver" there).