# Calibration with Matlab

#### Erdiablo

Hi all,

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

#### Erdiablo

I'm sorry maybe the suited section was the "Computing" one, how can I move the post there?

#### daleholborow

if you're trying to do a least squares solver, i think there is a better way to solve for these params. Do a search for one of my earlier posts, about bond pricing models and code i wrote for a thesis. In my code, you'll find examples of fittign to curves solving for unknown parameters using various matlab libraries (vasicek interest rate model, and two bond pricing models)... that should give you a starting point.

#### Bastian Gross

##### German Mathquant
Hi all,

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.

......

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

I would write a new function as m-file:

C++:
function y = barrier(sigma, L)

r=.... %all given parameters

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

Replies
0
Views
998
Replies
2
Views
977
Replies
3
Views
2K
Replies
7
Views
2K
Replies
6
Views
2K