RCI is a novel superresolution staring imaging technique based on the idea of wavefront modulation and temporal-spatial stochastic radiation field. For RCI, the reference matrix should be known accurately, and the imaging performance depends on the incoherence property of the reference matrix. Unfortunately, the modeling error, which degrades the performance significantly, exists generally. In this paper, RCI using frequency-hopping waveforms (FH-RCI) is considered, and a FH code design method aiming to increase the robustness of RCI to modeling error is proposed. First, we derive the upper bound of imaging error for RCI with modeling error and conclude that the condition number of the reference matrix determines the imaging performance. Then the object function for waveform design which minimizes the condition number of the reference matrix is achieved, and the quantum simulated annealing (QSA) is employed to optimize the FH code. Numerical simulations show that the optimized FH code could decrease the condition number of the reference matrix and improve the imaging performance of RCI with modeling error.