Spectral analysis of finite-dimensional approximations of 1d waves in non-uniform grids