Your scaling seems to be out of whack--adding 10+length(x) is creating a Z of
>> [min(Z(:)) max(Z(:))]
Hence your axis command puts the Z axis range quite a long distance below where the data values are.
It appears from the functional definition, the offset factor you're looking for would be 20; 2X the scale factor of the cosine term. If I do that and then
get an interesting figure, indeed. Hadn't heard of the rastrigin function...