Arduino Due, How to Change PWM frequency

I am using Arduino to control a MOSFET based Buck converter. By default, the PWM pins 2 through 13 have 1kHz output frequency. I need to change it to 100kHz. How can I do it?

I am using analogWrite(pin, value) to get the PWM output.

I tried changing the value of PWM frequency in the Variant.h file but that didn't do anything.

Code:
int DR = 0; //initializing for duty ratio.
void setup()
{
pinMode(6, OUTPUT);
pinMode(0, INPUT);
pinMode(2, INPUT);
}

void loop()
{
if (analogRead(0) > analogRead(2))
{
if (DR < 255)
{
DR++; //if pin0>pin2 and the duty ratio value is less than 255, increase DR
}
}

if (analogRead(0) < analogRead(2))
{
if (DR > 0)
{
DR--; //if pin0<pin2 and the duty ratio value is less than 255, increase DR
}
}

analogWrite(6, DR);

}

Forget analogWrite() if you need to change PWM frequency.

There is the PWM library from antodom, and numerous example PWM sketches in the DUE sub forum.