- Motivation
- Discrete-Time Signals
- The Discrete Fourier Transform (DFT)
- The Inverse Discrete Fourier Transform (IDFT)
- Matlab Examples
- Periodic Signals
- Time-Varying Spectra

- The vibrations of objects and materials are typically not uniform for different vibration frequencies. Thus, it is necessary to use and understand methods which seek to characterize systems based on either their time-domain or frequency-domain behaviors.
- A simple sinusoidal signal, such as
, is easily recognized in the time-domain.
- A complex waveform like that of Fig. 9, however, is less clear. Transforming a time-domain signal into its corresponding frequency-domain representation often helps to make apparent important characteristics of that signal.

- Because we are using computers to analyze sounds, we must be concerned with discrete-time, finite duration signals.
- By Shannon's sampling theorem and the Nyquist rate:

- The DFT is efficiently implemented using the Fast Fourier Transform (FFT).

- The DFT and IDFT are lossless transformations ... no data or information is lost in transforming back and forth between the two representations.

- To create a simple sinusoidal signal:
fs = 22050; % sampling rate T = 1/fs; % sampling period t = [0:T:0.25]; % time vector f1 = 50; % frequency #1 omega1 = 2*pi*f1; % angular frequency #1 phi = 2*pi*0.75; % arbitrary phase offset = 3/4 cycle x1 = cos(omega1*t + phi); % sinusoidal signal, amplitude = 1 plot(t,x1); xlabel('Time (seconds)'); ylabel('x1');

- To calculate and view the FFT of the simple sinusoid:
X1 = fft(x1); % FFT of x1 N = length(t); % N = length of fft f = [0:N-1]*fs/(N-1); % frequency vector plot(f,abs(X1)); % plot magnitude xlabel('Frequency (Hertz)'); ylabel('X1'); axis([0,fs/2,0,max(abs(X1))]); % display only frequencies < fs/2

- To create a more complex signal (using sinusoids):
phi = 2*pi*0.25; % 1/4 cycle phase offset x1 = cos(omega1*t + phi); % sinusoidal signal, amplitude = 1 x2 = cos(2*pi*150*t + phi)/3; % sinusoidal signal, amplitude = 1/3 x3 = cos(2*pi*250*t + phi)/5; % sinusoidal signal, amplitude = 1/5 x4 = cos(2*pi*350*t + phi)/7; % sinusoidal signal, amplitude = 1/7 x5 = cos(2*pi*450*t + phi)/9; % sinusoidal signal, amplitude = 1/9 xcomplex = x1+x2+x3+x4+x5; plot(t,xcomplex); xlabel('Time (seconds)'); ylabel('xcomplex');

- To calculate and view the FFT of the complex signal:
Xcomplex = fft(xcomplex); % FFT of xcomplex plot(f,abs(Xcomplex)); xlabel('Frequency (Hertz)'); ylabel('Xcomplex'); axis([0,1000,0,max(abs(Xcomplex))]);

- Window xcomplex before doing FFT:
Xcompwin = fft(xcomplex.*hanning(N).'); plot(f,abs(Xcompwin)); xlabel('Frequency (Hertz)'); ylabel('Windowed Xcomplex'); axis([0,1000,0,max(abs(Xcompwin))]);

- Zero-pad xcomplex before doing FFT:
Xcompzp = fft([xcomplex,zeros(1,N)]); fzp = [0:2*N-1]*fs/(2*N-1); plot(fzp,abs(Xcompzp)); xlabel('Frequency (Hertz)'); ylabel('Zero-Padded Xcomplex'); axis([0,1000,0,max(abs(Xcompzp))]);

- If a signal composed of many different frequency components (a complex signal) is periodic, each component frequency or partial must have an integer-multiple relationship to the ``fundamental'' frequency (which might not itself be a component of the signal).
- A periodic, complex signal:
fs = 22050; % sampling rate T = 1/fs; % sampling period t = [0:T:0.15]; % time vector f1 = 50; % frequency #1 omega1 = 2*pi*f1; % angular frequency #1 x1 = cos(omega1*t); x2 = cos(2*pi*100*t); x3 = cos(2*pi*150*t); x4 = cos(2*pi*200*t); x5 = cos(2*pi*250*t); xcomplex = x1+x2+x3+x4+x5; plot(t,xcomplex); grid xlabel('Time (seconds)'); ylabel('xcomplex');

- A periodic, complex signal with ``missing'' fundamental:
fs = 22050; % sampling rate T = 1/fs; % sampling period t = [0:T:0.15]; % time vector x2 = cos(2*pi*100*t); x3 = cos(2*pi*150*t); x4 = cos(2*pi*200*t); x5 = cos(2*pi*250*t); xcomplex = x2+x3+x4+x5; plot(t,xcomplex); grid xlabel('Time (seconds)'); ylabel('xcomplex');

- A non-periodic, complex signal:
fs = 22050; % sampling rate T = 1/fs; % sampling period t = [0:T:0.25]; % time vector f1 = 50; % frequency #1 omega1 = 2*pi*f1; % angular frequency #1 x1 = cos(omega1*t); x2 = cos(2*pi*100*t); x3 = cos(2*pi*127.69*t); x4 = cos(2*pi*200*t); x5 = cos(2*pi*250*t); xcomplex = x1+x2+x3+x4+x5; plot(t,xcomplex); grid xlabel('Time (seconds)'); ylabel('xcomplex');

- Most musical signals have time-varying frequency content.
- In this case, we take FFTs of successive (or overlapping) chunks of data to see how the spectrum evolves over time.
- Window functions are typically used to help smooth the spectra. The details of window functions and their influence on the resulting spectra is beyond the scope of this course ... see MUS420.
- The application ``snd'' will be a useful tool for viewing time-varying spectra.

©1998-2001 CCRMA, Stanford University. All Rights Reserved. Maintained by Gary P. Scavone, gary@ccrma.stanford.edu. |