Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is Nyquist sampling theorem

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "what is Nyquist sampling Theorem". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the Nyquist sampling theorem"!

There are all kinds of analog signals around us, such as current, electromagnetic wave, temperature, sound and so on. As a computer system, it only knows 0 and 1, which means it can only process digital information, but how does it deal with these analog signals around us? To understand this problem, we need to understand a very important theorem in the field of digital signal processing-sampling theorem, which is a basic bridge between analog signals and digital signals. This paper will study the Nyquist-Shannon sampling theorem with you.

The sampling theorem was first put forward by Nyquist, an American telecommunications engineer, in 1928, so it is called Nyquist sampling theorem. This theorem was first strictly expressed in formula by Soviet engineer Kotelnikov in 1933, so it is called Kotelnikov sampling theorem in Soviet literature. Shannon, the founder of information theory in 1948, clearly explained this theorem and formally quoted it as a theorem, so it is also called Shannon sampling theorem in many literatures.

Let's first look at the following example, for a sinusoidal signal:

If we take points at intervals of 0.5 and 0.25 respectively, and then connect each point with a straight line.

It can be found from the above figure that the smaller the time interval is, the more points the signal is recorded, and the more accurate the signal is restored. Obviously, it is impossible for us to record this signal with an infinite number of points. How can we express the signal accurately and use computer resources reasonably?

In fact, the bosses have long studied the Nyquist-Shannon sampling theorem that we are going to learn today.

The sampling frequency should be more than 2 times the highest frequency of the signal in order to retain the complete information of the signal without distortion.

That is:

Here, we call this signal frequency (this critical point) the Nyquist frequency. Let's first understand this theorem through an experiment, if there is a signal like this:

Then sample at the sampling rate of 5Hz, 10Hz, 10Hz, 10Hz and 100Hz, respectively, and observe the signal recovery in time domain and frequency domain under different sampling rates. The old rules are coded first.

Import numpy as np import matplotlib.pyplot as plt def signalCreate (_ fs, _ N, _ f0): fs = _ fs # sampling rate N = _ N # data points f0 = _ f0n = np.linspace (0, NMU1 N) t = n / fs yt = np.exp (1j*2*np.pi*f0*t) f = n * fs/ N-fs/2 yf = np.fft.fftshift (np.fft.fft (yt)) return t, yt, f, yf t, yt, f, yf = signalCreate (5,128,5) plt.subplot (5,2,1) plt.plot (t, yt) plt.subplot (5,2,2) plt.plot (f, np.abs (yf)) t Yt, f, yf = signalCreate (10,128,5) plt.subplot (5,2,3) plt.plot (t, yt) plt.subplot (5,2,4) plt.plot (f, np.abs (yf)) t, yt, f, yf = signalCreate (20,128,5) plt.subplot (5,2,5) plt.plot (t, yt) plt.subplot (5,2,6) plt.plot (f, np.abs (yf)) t, yt, f, yf = signalCreate (40,128) 5) plt.subplot (5,2,7) plt.plot (t, yt) plt.subplot (5,2,8) plt.plot (f, np.abs (yf)) t, yt, f, yf = signalCreate (100,128,5) plt.subplot (5,2,9) plt.plot (t, yt) plt.subplot (5,2,10) plt.plot (f, np.abs (yf)) plt.show ()

The result is shown in the following figure, on the left is the time domain and the right is the frequency domain. When the sampling frequency is 5Hz, the restored signal is a DC signal with a frequency of 0. obviously, it is impossible to accurately restore the original signal when the sampling frequency is less than twice the signal frequency; when the sampling frequency is 10Hz, the restored signal still seems to be something wrong, and it is obvious that the signal can not be displayed completely in the frequency domain. When the sampling frequency is 20Hz, the restored signal in both time domain and frequency domain is very close to the original signal; of course, we continue to increase the sampling frequency, when the sampling frequency is 40Hz and 100Hz, the restored signal is closer to the real signal.

Sampling with different sampling rates

However, by comparing the frequency domain graphics of the sampling frequency 40Hz and 100Hz, we can find that 100Hz is obviously fatter. This is because the frequency resolution becomes larger, the number of sampling points remains unchanged, and the sampling resolution increases with the increase of sampling frequency domain. The sampling resolution can be calculated by the following formula:

Obviously, if the sampling frequency is too low, the real signal can not be restored correctly; but if the sampling frequency is too high, there will be a larger frequency resolution, and a large amount of data will be generated at the same time. In general, in practical applications, the sampling frequency is chosen to be larger than twice the Nyquist frequency (for example, 3 to 5 times).

In addition, in the process of sampling, comparing the relationship between the sampling frequency and the Nyquist frequency, we can also describe it as follows:

The sampling frequency is more than twice the Nyquist frequency, which is called oversampling.

The sampling frequency is less than twice the Nyquist frequency, which is called undersampling.

At this point, I believe you have a deeper understanding of "what is the Nyquist sampling theorem". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report