- First, start by setting up your initial parameters like the “T”, “K”, and the time step “dT”.
- Define the grid “S” as specified, which includes various points where you'll calculate the option values.
- For each point in the grid, calculate the option value at time “t = 0” and “S = 100” using a pricing model such as Black-Scholes or a binomial tree. You can use MATLAB functions like “linspace” to create segments of your grid and “arrayfun” to apply the pricing model across the grid points.
- Store these calculated option values in a table format to show how the values converge as the grid points and time steps vary.
- linspace: https://www.mathworks.com/help/matlab/ref/double.linspace.html
- arrayfun: https://www.mathworks.com/help/matlab/ref/arrayfun.html
- tables: https://www.mathworks.com/help/matlab/tables.html