function [v,op,ca]=junk(par) % gives the sum of squared distances to the observed options prices for NIG % model. since we need alpha>|beta+1| we write par=[log(alpha-abs(1+beta), beta,delta] ; % run this as ... % OPTIONS = OPTIMSET('TolFun',1); par=fminsearch('junk',[ 4.2557 -5.5009 0.6901],OPTIONS); ca=[173.1000 124.8000 88.5000 53.7000 39.3000 27.3000 17.8500 10.9500 6.2000 3.2500]; K=[950 1005 1050 1100 1125 1150 1175 1200 1225 1250]; alpha=abs(par(2)+1)+exp(par(1)); op=nigcall(1116.84,K,.01,.3699,alpha,par(2),par(3)); v=sum((1-op./ca).^2); plot(ca,ca,'-',ca,op,'r') ylabel('nig price') xlabel('observed price')