Open-loop and Closed-loop Filters for Optimal Trajectory Planning under Time and Frequency Constraints