Optimal control of wave cycloidal rotors with passively morphing foils: An analytical and numerical study