You can use Matlab's diff() function to calculate numerical derivatives. The following assumes that the biggest value in 'x' is the last value, and that the vector is equally-spaced.
dx=x(end)/length(x); % Calculate dx
dy=diff(y)/dx; % Calculate numerical derivative
dx2=x(end-1)/length(dy); % Calculate dx2
d2y=diff(dy)/dx2; % Calculate numerical second derivative
x=x(1:end-2); % Shorten vectors for plotting
y=y(1:end-2);
dy=dy(1:end-1);
figure;plot(x,y,x,dy,x,d2y);
If ode45() is not giving you equally-spaced time points, you should make your tspan vector like this, say if you want 1,000 points:
tspan = linspace(0,L,1000);
Also you don't need the semicolon after declaring global variables. I think that might even mess something up.
Hope that is helpful!