Digital Sound & Music: Concepts, Applications, & Science, Chapter 2, last updated 6/25/2013
radians in a cycle, and Hz is cycles/s, the relationship between frequency in Hertz and angular
frequency in radians/s is as follows:
be the frequency of a sine wave in Hertz. Then the angular frequency,
in radians/s, is given by
We can now give an alternative form for the sine function.
A single-frequency sound wave with angular frequency ω, amplitude
is represented by the sine function
In our examples below, we show the frequency in Hertz, but you should be aware of these two
equivalent forms of the sine function. MATLAB‟s sine function expects angular frequency in
Hertz, so f must be multiplied by 2.
Now let‟s look at how we can model sounds with sine functions in MATLAB. Middle C
on a piano keyboard has a frequency of approximately 262 Hz. To create a sine wave in
MATLAB at this frequency and plot the graph, we can use the fplot function as follows:
fplot('sin(262*2*pi*t)', [0, 0.05, -1.5, 1.5]);
The graph in Figure 2.30 pops open when you type in the above command and hit Enter. Notice
that the function you want to graph is enclosed in single quotes. Also, notice that the constant
is represented as pi in MATLAB. The portion in square brackets indicates the limits of the
horizontal and vertical axes. The horizontal axis goes from 0 to 0.05, and the vertical axis goes
from –1.5 to 1.5.
Figure 2.30 262 Hz sine wave
If we want to change the amplitude of our sine wave, we can insert a value for
, we may have to alter the range of the vertical axis to accommodate the higher amplitude,