11.2: Analog and Digital Systems and Fast Fourier Transform (FFT)

Mechatronics: Fundamentals, Design, Integration, and Validation · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-NC 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    11.2: Analog and Digital Systems and Fast Fourier Transform (FFT)
    Lab B.2 Objectives

    After completing this lab section, you will be able to:

    1. Understand the analog system and the associated digital system through sample and hold discretization.
    2. Understand the principle of the FFT (fast Fourier transform).

    Zero-Order Hold

    In Chapter 4, the graph in Figure B.19 was introduced to provide a basic concept of D/A (digital-to-analog) and A/D (analog-to-digital) conversions. In this lab section, the Simulink is used to simulate the A/D conversion process.

    A block diagram of mechatronic system consisting of both information and physical domains with an interface intertwined. Sensor signals in the physical domain are sampled into the information domain, and control commands generated in the information domain are amplified in the interface and sent to actuators in the physical domain.
    Figure B.19: Mechatronic system with A/D and D/A converters.

    The A/D data sampling with the zero-order hold process can be realized in the Simulink with block Zero order hold and followed with the Quantizer block for quantization. Follow the two steps described below to generate a Simulink model, shown in Figure B.20; these results are required for your report.

    A Simulink block diagram of zero-order sample and holder with quantization comparing with the original analog signal.
    Figure B.20: Zero-order sample and holder with quantization.
    1. Choose the blocks in Figure B.20 from the Simulink library browser, build the model indicated in Figure B.20. Set the zero-order hold sample period to 0.4 second.
    2. Edit the parameters in the Sine Wave block as below to generate a sinusoidal signal, \(2\mathrm{sin}\mathrm (40πt)\); see Figure B.21. Record the frequency of this signal in your short form (lab report).
    A screenshot of Simulink parameter window for the "Sine Wave" block used to calibrate signal magnitude, frequency, phase, and sample time.
    Figure B.21: Calibration window of the “Sine Wave” block.

    Note that Lab B.2 has three main tasks to be completed, shown below, to be completed, utilizing the model developed in Figure B.20.

    Task #1:

    1. Edit the parameters in the Quantizer block, as shown in Figure B.22. Here, 4 is the magnitude of the input signal and an 8-bit quantizer is used to represent \(2^8\) steps with a maximum digital number of \({\mathrm{2}}^{\mathrm{8}}\mathrm{-1}\).
    2. Edit the parameters in the Zero-Order Hold block and set sample time to 0.04 second. Write down the sample frequency (in unit Hz) in the short form and show the simulation results.
    3. Edit the parameters in the Zero-Order Hold block and set sample time to 0.033 second. Write down the sample frequency (in unit Hz) in the short form and show the simulation results.
    4. Compare simulation results from Steps 2 and 3. Then describe how the sample period influenced sampled digital signals.
    A screenshot of Simulink parameter window for the "Quantizer" block used to calibrate the quantization interval.
    Figure B.22: Calibration window of “Quantizer” block.

    Task #2:

    1. Keep the configuration for the quantizer unchanged.
    2. Edit parameters in the Zero-Order Hold block and set sample time to 0.025 second. Write down the sample frequency (in unit Hz) in the short form and show the simulation results.
    3. Edit parameters in the Zero-Order Hold block with sample time of 0.025 second. Add \(π/6\ (rad)\) phase delay to the original sinusoidal wave and keep its frequency unchanged at 20 Hz. Show the final simulation results. Can the frequency and amplitude of the signal be recovered based on Nyquist-Shannon theory?
    4. Edit parameters in the Zero-Order Hold block and set sample time to 0.005 second. Write down the sample frequency (in unit Hz) in the short form and show the simulation results.
    5. Edit parameters in the Zero-Order Hold block and set sample time to 0.0025 second. Write down the sample frequency (in unit Hz) in the short form and show the simulation results
    6. Compare simulation results from Steps 2, 4, and 5. Describe how sample time influences sampled results.

    Task #3:

    1. Set the sample time to 0.001 second and keep it for the following two steps.
    2. Set the quantization bit to 4 in the Quantizer block and show the simulation results.
    3. Set the quantization bit to 16 in the Quantizer block and show the simulation results.
    4. Compare simulation results from Steps 2 and 3. Describe how the quantizer number of bits influences sampled results.

    FFT of Digital Signals

    FFT Code for Single Sided Spectrum. Use Fourier transforms to find the frequency components of a signal. Specify the signal parameters with a sampling frequency of 1 kHz and a period of 1.5 seconds. Generate a summation of two sinusoidal signals, one with a frequency of 50 Hz and amplitude of 0.7 and other with a frequency of 120 Hz and amplitude 1. That is, the generated signal is, \(S=0.7\times sin(2π\times 50t)+sin(2π\times 120t)\). It is difficult to identify the frequency components by directly looking at the generated signal in the time domain. Compute the two-sided spectrum of \(P2\) using FFT. Then compute the single-sided spectrum \(P1\) based on \(P2\) by trimming the negative frequency part off. Define the frequency vector f and plot the single-sided amplitude spectrum \(P1\). On average, longer signals produce better frequency approximations using FFT. The code is shown in Figure B.23.

    Sample MATLAB code of fast Fourier transform for a summation of two sinusoidal signals and plot its magnitude.Figure B.23: FFT Code.
    Exercise B2.1

    Obtain the FFT response of the following time-domain function

    \[y=0.7{\mathrm{sin} \left(2π\times 50t\right)\ }+{\mathrm{sin} \left(2π\times 100t\right)\ }+2\mathrm{sin}\mathrm (2π\times 100400t) \label{B.4}\]

    with other parameters the same as those in Figure B.23. Find the frequency components of the original signal before FFT. Next, write down the three frequencies from the FFT plot Then compare your results. Are they the same and, if so, why?


    This page titled 11.2: Analog and Digital Systems and Fast Fourier Transform (FFT) was last modified on Thu, 23 Jul 2026 04:49:19 GMT and is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Guoming Zhu (Co-DREAM OER) .