Distorted voltage supplied as unbalanced and/or non-constant frequency can be found in weak grids, such as microgrids, or systems working in islanding mode. These kinds of systems are more sensitive under load changes. Particularly, an unbalanced voltage supply may be produced for large, single-phase loads. On the other hand, the connection/disconnection of high current loads may lead to important frequency variation, especially in weak grids where the short circuit current capacity is reduced. These conditions make the control of the power converter a more difficult task, because of the variations in the frequency and unbalancing. To address these issues, this paper proposes a resonant control algorithm to deal with variations in the voltage amplitude as well as grid frequency when a distorted power supply is considered. The frequency variation is an important drawback for resonant control because the resonance must be tuned at the grid frequency. This issue is overcome by using a variable sampling frequency in order to avoid re-tuning the controller parameters. On the other hand, under unbalanced conditions, the proposed method relaxes the phase with lower voltage amplitude by taking more power from the other phases in order to help the stability of the grid supply. To corroborate the mathematical analysis and the proposed control, a stability study is performed, including experimental and simulated results.