Rayleigh-Ritz analysis of sandwich beams