Sampling a Signal in Matlab

Generating a continuous signal and sampling it at a given rate is demonstrated here. In simulations, we may require to generate a continuous time signal and convert it to discrete domain by appropriate sampling.

For baseband signal, the sampling is straight forward. By Nyquist Shannon sampling theorem, for faithful reproduction of a continuous signal in discrete domain, one has to sample the signal at a rate \(fs\) higher than at-least twice the maximum frequency \(fm\) contained in the signal (actually, it is twice the one-sided bandwidth occupied by a real signal.

Matlab or any other simulation softwares process everything in digital i.e, discrete in time. Therefore, we cannot generate a real continuous-time signal on it, rather we can generate a “continuous-like” signal by using a very very high sampling rate. When plotted, such signals look like a continuous signal.

Let’s generate a simple continuous-like sinusoidal signal with frequency \(fm = 10kHz\). In order to make it appear as a continuous signal when plotting, a sampling rate of \(fs=500kHz\) is used.

Pretending the above generated signal as a sinusoidal signal, we would like to convert the signal to discrete-time equivalent by sampling. By Nyquist Shannon Theorem, the signal has to be sampled at at-least $ fs =2∗fm =20kHz $. Let’s sample the signal at $ fs1 =30kHz$ and then at \(fs1 =50kHz\) for illustration.

[code]
https://files.cnblogs.com/files/mathlife/samplerate.rar

猜你喜欢

转载自www.cnblogs.com/mathlife/p/9081787.html