Cpu and gpu frequencies

How do I set the correct cpu and gpu frequencies in ubuntu 16 (2018) and 2019?