This example illustrates how DSP System Toolbox implements the spectral analysis method known as the periodogram. A periodogram computes the spectral content of a live input signal from a microphone over time.
Data Acquisition Toolbox provides a complete set of tools for analog input, analog output, and digital I/O from a variety of PC-compatible data acquisition hardware. The toolbox lets you configure your external hardware devices, read data into MATLAB and Simulink for immediate analysis, and send out data.
This example uses the Analog Input block from Data Acquisition Toolbox to acquire live signals from a data acquisition device and pass them into Simulink. In this example, the sound card is selected as the input device in the Analog Input block.
This example requires Data Acquisition Toolbox, a Windows sound card, and a microphone to send audio signals.
The input signal is a real-time audio signal from a microphone. In this example, the Analog Input block is configured to receive data in asynchronous mode such that all the data is buffered and no data is lost during the simulation. The block can also be configured to run in synchronous mode in situations where only the most recent set of data is important.
The signal is buffered into frames of 128 samples each. Each frame is then windowed using a Hamming window function, and the DSP System Toolbox computes the FFT for the windowed frame. The system collects the FFTs for successive frames and plots them to produce a spectrogram.
Even though a Windows sound card is used for this example, you can update this model to connect to other supported data acquisition devices. This provides you the flexibility to use the same Simulink model with different data acquisition devices.