A transistor can be used as an oscillator to generate a periodic waveform such as a sine wave or a square wave.
To create an oscillator with a transistor, a feedback network is used to provide positive feedback to the transistor circuit. The feedback network typically consists of a combination of resistors, capacitors, and inductors that are connected between the input and output of the transistor amplifier. The feedback network provides a signal that is out of phase with the input signal, causing the transistor to oscillate and generate a periodic waveform.
One common type of oscillator circuit that uses a transistor is the Colpitts oscillator, which consists of a transistor amplifier with a feedback network that includes two capacitors and an inductor. The Colpitts oscillator produces a sinusoidal waveform with a frequency that is determined by the values of the capacitors and inductor in the feedback network.