%CH11      Program for Chapter 11
%
% Draws Black-Scholes surface for European call
%
%  THIS IS A CORRECTED VERSION, AS OF JULY, 2004. SEE
%   http://www.maths.strath.ac.uk/~aas96106/option_book.html#errs
%

clf

%%%%%%%%%% Problem parameters %%%%%%%%%%%%%%
E = 1; r = 0.05; sigma = 0.2; T = 1; L = 50;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Svals = linspace(0,3,L);
tvals = linspace(0,T,L);
C = zeros(L,L);
for i = 1:L
    S = Svals(i);
    for j = 1:L
        t = tvals(j);
        [Call,Calldelta,Put,Putdelta] = ch08(S,E,r,sigma,T-t);
        C(i,j) = Call;
    end
end

[Smat,tmat] = meshgrid(Svals,tvals);
mesh(Smat,tmat,C')
xlabel('S'), ylabel('t'), zlabel('C(S,t)')
