This script calculates price for up and out barrier call option on non-dividend paying stock, as described in section 19.14 of Hull's "Options,Futures and Derivatives" book.
The matrix hedgeMat contains results of table 19.1, which is the portfolio of European call options used to replicate the up-and-out option:
column 1:Strike price
column 2: Maturity
column 4:Initial value
total_initial_value approaches the barrier option price if no. of timesteps are increased beyond 100
Note : requires file Black Scholes Price & Greeks