Analysis of Position and Velocity Variations for Hyperbolic Orbits and Application to the Flyby Anomaly