Make sure the size of d is right:
If length(a) = n and length(L) = m, then, you have to have size(d) = [m x n]
a = rand(10,1);
L = rand(5,1);
[aa,LL] = meshgrid(a,L);
Z = rand(10,5);
Error using mesh (line 76)
Data dimensions must agree.
from documentation: mesh(X,Y,Z) draws a wireframe mesh with color determined by Z, so color is proportional to surface height. If X and Y are vectors, length(X) = n and length(Y) = m, where [m,n] = size(Z).