2 scalars:
- an annualized risk-free rate
- the current price of an underlying asset
3 vectors:
- a vector of time to maturity
- a vector of strike prices
- a vector European call prices gotten from the market for the same underlying asset.
The function VolSurface.m will then:
- compute and output the Black-Scholes implied volatility (this will be a matrix).
- get and plot the corresponding volatility surface using a kernel (Gaussian) density estimation.
Dear Rodolphe,
In follow up to my previous question: More important than the graph, shouldn't the surface structure return T, M, and IV to Example 1 (once I comment out the graphing issue)? I receive empty matrices.
Output:
Elapsed time is 0.552350 seconds.
>> whos
Name Size Bytes Class Attributes
Dear George,
I used the fzero command is my code which uses an algorithm originated by T. Dekker: a combination of bisection, secant, and inverse quadratic interpolation methods.
Matlab has the advantage of having a lot of built-in functions like this that you can use to make coding easier. When coding, you don't actually need to write your own algorithms but you should use the available Matlab functions who do the hard work for you.
I hope it answers you question.
thx for the feedback.
I can't understand the method you are using in order to calculate the implied volatility, ImpliedVol(i). Why you don't use newton raphson method or bisection method, in order to match the volatility with the option market price coming from the BS formula?
Yes you can just modify the output of the function BlackScholesPricer so that it gives you the put price instead of the call price.
Alternatively you can convert the put prices into call prices using the put-call parity so that you don't have to modify the code.
Hope it helps