Department of Computer Engineering
Department of Computer Engineering
Department of Computer Engineering
RollNo. : 73
Division : BE –CMPN
Day/Session : Monday/Afternoon
Venue : GoogleMeet
ExperimentNo. 1
SAMPLING OF SIGNAL
THEORY:
SAMPLING THEOREM
In the field of digital signal processing, the sampling theorem is a fundamental bridge
between continuous-time signals (often called "analog signals") and discrete-time signals (often called
"digital signals"). It establishes a sufficient condition for a sample rate that permits a discrete sequence
of samples to capture all the information from a continuous-time signal of finitebandwidth.
If a function x(t) contains no frequencies higher than B hertz, it is completely determined by giving its
ordinates at a series of points spaced 1/(2B) seconds apart.
When the bandlimit is too high (or there is no bandlimit), the reconstruction exhibits imperfections
known as aliasing. Modern statements of the theorem are sometimes careful to explicitly state that x(t)
must contain no sinusoidal component at exactly frequency B, or that B must be strictly less than ½ the
sample rate. The two thresholds, 2B and fs/2 are respectively called the Nyquist rate and Nyquist
frequency. And respectively, they are attributes of x(t) and of the sampling equipment. The condition
described by these inequalities is called the Nyquist criterion, or sometimes the Raabe condition. The
theorem is also applicable to functions of other domains, such as space, in the case of a digitized
image. The only change, in the case of other domains, is the units of measure applied to t, fs, andB.
The symbol T = 1/fs is customarily used to represent the interval between samples and is called
the sample period or sampling interval. And the samples of function x(t) are commonly denoted
by x[n] = x(nT) (alternatively "xn" in older signal processing literature), for all integer values of n. A
mathematically ideal way to interpolate the sequence involves the use of sinc functions. Each sample in
the sequence is replaced by a sinc function, centered on the time axis at the original location of the
sample, nT, with the amplitude of the sinc function scaled to the sample value, x[n]. Subsequently, the
sinc functions are summed into a continuous function. A mathematically equivalent method is to
convolve one sinc function with a series of Dirac delta pulses, weighted by the sample values. Neither
method is numerically practical. Instead, some type of approximation of the sinc functions, finite in
length, is used. The imperfections attributable to the approximation are known as interpolationerror.
Practical digital-to-analog converters produce neither scaled and delayed sinc functions, nor ideal Dirac
pulses. Instead they produce a piecewise-constant sequence of scaled and delayed rectangular
pulses (the zero-order hold), usually followed by an "anti-imaging filter" to clean up spurious high-
frequencycontent.
CLASSIFICATION OF SIGNALS:
CODE
clear all;
clf();
clc;
x1=0:5;
y1=[ones(1,4),zeros(1,2)];
y2=[ones(1,6)];
y3=exp(x1);
y4=x1;
subplot(2,3,1);
plot2d3(x1,y1);
xlabel('Time');
ylabel('Amplitude');
title('Sample Discrete Signal');
subplot(2,3,2);
plot2d3(x1,y3);
xlabel('Time');
ylabel('Amplitude');
title('Exponential Signal');
subplot(2,3,3);
plot2d3(x1,y4);
xlabel('Time');
ylabel('Amplitude');
title('Unit Ramp Signal');
subplot(2,3,4);
plot2d3(x1,y2);
xlabel('Time');
ylabel('Amplitude');
title('Unit Step Discrete Signal');
subplot(2,3,5);
sx=[0:0.1:2*%pi];
plot2d(sin(sx));
title('Sine Wave');
subplot(2,3,6);
cx=[0:0.1:2*%pi];
plot2d(cos(cx));
title('Cosine Wave');
OUTPUT
UP-SCALING:
CODE
clc;
clf();
clearall;
n = input('Enter Length of Sinuisoidal Sequence ');
l = input('Enter Length of Sampling Factor ');
n = 0:0.01:n-1;
x = sin(2*%pi*n);
y = zeros(1,l*length(x));
y([1:l:length(y)])=x;
subplot(2,2,1);
plot2d3(n,x);
xlabel('Time');
ylabel('Amplitude');
title('Input Signals');
subplot(2,2,2);
plot2d3(n,y(1:length(x)));
xlabel('Time');
ylabel('Amplitude');
title('Upsampling');
OUTPUT
Enter Length of Sinuisoidal Sequence = 10
Enter Length of Sampling Factor = 5
CONCLUSION:
Thus we have studied the classification and sampling of signals using the Scilab Tool to execute the
programs.