I need to adjust frequency to 20kHz

void setup() {
TCCR2A = TCCR2A | 0x30;
TCCR2B = TCCR2B & 0xF8 | 0x01;
  analogWrite(3, 127);
  analogWrite(11, 127);


}

void loop() {

}

According to the code, I need to adjust frequency to 20kHz. How can I modify the code ?

For timer1 I've this code:

void setup ()
{
  pinMode (9, OUTPUT) ;
  pinMode (10, OUTPUT) ;
  TCCR1A = 0xE2 ;
  TCCR1B = 0x1A ;
  ICR1  = 100-1 ;
  OCR1A = 50-1 ;
  OCR1B = 50-1 ;
  TCNT1 = 0x0000 ;
}

Note timer2 and timer1 are different in detail, the datasheet will be needed, but something analogous to this will work:

Here I'm clocking the timer at 2MHz (divide-by-8 prescaler) and then counting upto 100 to get 20kHz, and selecting 50% duty cycle for square wave on both channels (which are pins 9 and 10 for timer1 on Uno). The mode for the timer is the one that counts upto the value of the ICR register.

Do you want to have the PWM frequency at 20KHz AND have the full PWM duty cycle range? You can not do that for just any frequency you know.

So what do you want, the closest to 20KHz and full PWM control or just 20KHz?