I am creating a grid as
Print["no of grid points, lattice length, dz " , {max = 10, L = 10.,dz=L/max}]
grid = Table[-L/2 + (n - 1) dz, {n, 1, max}]
grid2 = Table[-L/2 + (n - 1) dz, {n, 1, max, 2}]
The output is During evaluation of
no of grid points, co-ordinate lattice length, dz {10,10.,1.}
{-5., -4., -3., -2., -1., 0., 1., 2., 3., 4.}
{-5., -3., -1., 1., 3.}
I want to pad zeros in the grid2 on the places where I have not shown element. Means I need
{-5., 0., -3., 0., -1., 0., 1., 0., 3., 0.}
How can I do that?
Also what if I want to pad two or more zeroes as
{-5., 0., 0., -2., 0, 0., 1., 0., 0., 4.}