As you can see, not all the pins can provide a PWM output. Only pins 3, 5, 6, 9, 10 and 11. You must use one of these for analogWrite() to work.
That is for a hardware PWM (built-in the arduino). Software PWM is certainly possible too, on any pin, but the program would be more complex and use more processor time. I thought I saw a software PWM library somewhere, but I can't find it at the moment.
Btw, PWM (Pulse Width Modulation) is really a trick, it's not an analogue signal. It's digital, but as the name implies, its pulsing and the width of these pulses are what varies. The frequency on the arduino is about 450-500 Hz, so you wont see any flicker is you connect it to a LED.http://www.arduino.cc/en/Tutorial/PWM
Oh and you use a resistor in series with the LED I hope?
Don't forget to compensate for the eye's logarithmic respose, or you won't perceive a true sine brightnesss curve.
True, but I think we can forgo that for now?