Dynamic stability of moderately thick beams and frames with the use of harmonic balance and perturbation methods