DC Fan Help

yeah sorry that was the sketch of when i had the fan at high

//

const int transistorPin = 9;

void setup() {pinMode(transistorPin,OUTPUT);}

void loop()
{
//int sensorValue = analogRead(A0);
int outputValue = map(120,0,1023,0,255);
analogWrite(transistorPin,outputValue);
}

//

this one is where the fan makes a horrible on/off noise because each time a cycle comes round (e.g 50%) it goes on/off each time so instead of adjusting the voltage it keeps on going on and off so it makes a noise when the fan keeps going on and off :confused: it gets annoying as well