Analysis of Wave Propagation in Inhomogeneous Optical Fibers Using a Variational Method