Use this interactive display of Pulse Width Modulation to see how PWM works. The top example is the most useful for understanding PWM in dimmer switches and motor speed control
Copy this waveform and draw the PWM signal on the graph of this analogue wave with a pulse every 2ms
Draw the analogue waveform on this graph of the PWM signal
To understand exactly what is happening with the waveforms in a PWM circuit look at this sophisticated pulse width modulation applet, this only makes sense when you have built and tested your own circuit.
There is a simple interactive page that shows Pulse Width Modulation of a sine wave that is useful in understanding how PWM is used for modulating analogue waves.