I have to calibrate with matlab a model that calculates the prices of a down and out digital barrier option written on an underlying that follows a geometric brownian motion dynamics.

In practice I know that I have to find the parameters (sigma and the low barrier level L) minimizing the square difference between market price and model price for these options. My problem is how to write this in matlab.

Usually when I know the parameters I call the pde solver in this way in order to obtain model prices:

sol = pdepe(m,@pdefun_gbm,@pdeic,@pdebc,x,t1,[],r,sigma);

where x is the price grid: x= 15:0.5:50,so in this case L=15. How can I rearrange the formula above to take into account that now L and Sigma are for the moment unknown?

Any comments is really appreciate!!!

Thanks