# VERIFICATION OF SAMPLING THEOREM USING MATLAB SOFTWARE

Hello friends, today we are going to learn how to verify sampling theorem using MATLAB software. Before that we should know what sampling theorem is. It acts like a bridge between the Analog/continuous signals and discrete signals. Since it is used in Analog to digital converters (ADC) as well as in digital to analog converters (DAC). The other applications are 3D sampling,

SAMPLING THEOREM:

SAMPLING THEOREM states that "the sampling frequency is twice the highest frequency component in the continuous signal/Analog signal in order to recover the original signal."

There are different types of samplings:

1. IMPLUSE SAMPLING
2. NATURAL SAMPLING
3. FLAT TOP SAMPLING
4. 3D SAMPLING

Based on sampling ratio (fs/2fm) the sampling is of three types i.e. If fs>2fm then it is known as over sampling. If fs=2fm then it is Nyquist  sampling . If fs<2fm then it is known as under sampling. We can verify it using MATLAB Simulation software.

EXECUTION CODE:
clc;
clear all;    %IN ORDER TO CLEAR THE PREVIOUS DATA%
close all;    %TO CLOSE ALL PREVIOUS PROGRAMS%
t=0:001:1;
FM=input('ENTER THE SINGAL FREQUENCY(Fm) : ');
FS=input('ENTER THE SAMPLING FREQUENCY(Fs) : ');
subplot(2,1,1);
X=cos(2*pi*fm*t);    %TAKING COSINE SIGNAL%
plot(x,'r');
TS=0:(1/FS):1;    %SAMPLING TIME PERIOD%
X1=cos(2*pi*FM*TS);
subplot(2,1,2);
plot(ts,x1);
if FS>(2*FM)
title('OVER SAMPLING');
else if FS==(2*FM)
title('NYQUIST SAMPLING');
else if FS<(2*FM)
title('UNVER SAMPLING');
end