Changing analogWrite() function frequency

Changing the frequency on the Nano PWM output is a question of two lines of code:

// Pins D5 and D6 - 31.4 kHz
TCCR0B = 0b00000001; // x1
TCCR0A = 0b00000001; // phase correct

After then you could use the analogWrite() function as before, but with 31 KHz frequency

More info