function obj = Opzione(K,T0,T,C,N,a,b,sigma,r0)

r = fsolve(@(z) Obbl(T,C,N,a,b,sigma,z) - K,r0);

B0 = exp( - T0 * Vasicek(T0,a,b,sigma,r0));

[n m] = size(C);

for i = 1:n
  B(i) = exp( - T(i) .* Vasicek(T(i),a,b,sigma,r0));
  K(i) = exp( - T(i) .* Vasicek(T(i),a,b,sigma,r));
  s(i) = sigma/a * (1 - exp(-a*(T(i)-T0))) * sqrt((1 - exp(-a* ...
                                                    (T(i)-T0)))/2/a);
  capl(i) = Black(B(i),K(i)*B0,T0,s(i));
end 

C(n) = C(n) + N;

obj = C' * capl';

endfunction