Closed jlperla closed 7 years ago
Looking at that code, the key is to understand the construction of the A
matrix. In particular,
A =spdiags(Y,0,I,I)+spdiags(X(2:I),-1,I,I)+spdiags([0;Z(1:I-1)],1,I,I);
A(I,I)= Y(I) + sig2(I)/(2*dx2);
A(I,I-1) = X(I);
I think you finished this, so closing the issue.
Take a look at the stopping problem: http://www.princeton.edu/~moll/HACTproject/option_simple.pdf
Download http://www.princeton.edu/~moll/HACTproject/option_simple_LCP.m and http://www.princeton.edu/~moll/HACTproject/LCP.m
The goal is to figure out what the boundary value used for the right hand side of the finite difference scheme.. If the diffusion term was not there, this wouldn't be a problem since it uses the backward differences as upwind. But with the 2nd order term we need something else for the final point?