Uno PWM Frequency Change

Hey guys just a quick question. I am trying to change the frequency on some pins on my arduino uno in order to drive a solenoid and make an analog output with a low pass filter. I just want to clarify that I Have done it correctly because it doesn't seem like the frequencies are correct.

Here is what I have done, I have left out the pinModes etc

void setup(){
  //PWM Frequency Change
  //Change  Pins 3 & 11 to 31372 Hz for analog voltage output
  TCCR2B = TCCR2B & 0b11111000 | 0x01;
  
  //Change pins 9 and 10 to 122Hz for PWM
  TCCR1B = TCCR1B & 0b11111000 | 0x03;
}

Thanks for your help!

What frequencies were you expecting, and what ones did you get?

Here is what I have done, I have left out the pinModes etc

Oh, aye.

http://snippets-r-us.com/

I am trying to change the frequency on some pins on my arduino uno in order to drive a solenoid and make an analog output with a low pass filter.

What filter?