# How do you numerically solve the Dupire Local Volatility PDE in log moneyness-time space?

I am trying to implement a numerical solution to price vanilla calls. I am using the Dupire equation in log moneyness-time (k = ln(F/T)) space as per below PDE

I have tried solving it using a fully implicit scheme in Matlab and can't match market prices (black prices). I have used a flat local vol of 30% and a zero interest rate in the below matlab code. I suspect my k boundary condition may be the issue as I set it to the intrinsic value along these boundaries?

clc; clear;
xmin = -1.0890280712271;
xmax = 0.8471200635454;
T = 0.22739726;

M =97; % Number of space steps
dx = (xmax-xmin)/M;
N = 14; % Number of time steps
dt = (xmax-xmin)/N;

Price = zeros(N+1,M+1);
T_range = 0:dt:T;
x_range = xmin:dx:xmax;

LV = [0.416943422   0.371500369 0.356353595 0.343735066 0.3316299   0.319610453 0.309502636 0.320541186 0.35365883];

X = [-0.475738211   -0.237869105    -0.158579404    -0.079289702    0   0.079289702 0.158579403 0.237869105 0.475738211];

vols = interp1(X,LV,x_range,'linear');
for i = 1:(M+1)
if (x_range(i)<min(X))
vols(i) = LV(1);
else
if (x_range(i)>max(X))
vols(i) = LV(end);
end
end
end
vols(:) = 0.9;
%% Initial Condition
Price(1,:) = max( 1 - exp(x_range) , 0);

%% Boundary Conditions
% min k boundary
Price(:,1) = max( 1 - exp(xmin) , 0);

% max k boundary
Price(:,M+1) =  max(1 - exp(xmax), 0) ;

%% A matrix
alpha = -(vols.^2)/(2*dx^2);
a = -alpha*dt*(1+dx/2);
b = dt*(2*alpha + 1/dt);
c = alpha*dt*(1-dx/2);
A = zeros(M-1);

for j = 2:M-1
A(j,j-1) = a(j);
end

for j = 1:M-1
A(j,j) = b(j);
end

for j = 1:M-2
A(j,j+1) = c(j);
end

b = zeros(M-1,1);
b(1) = Price(1,1) * a(1);
b(M-1) = Price(N+1,M+1) * c(end);

%% Solve for Y
for i = 2:N+1
Price(i,2:M) = A \ (Price(i-1,2:M)' - b);
end