Vibration analysis of nanorods by the Rayleigh-Ritz method and truncated Fourier series