Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
SAMPLING THEOREM:
It states that the band limited signal x(t) having no frequency components
above Fmax Hz is specified by the samples that are taken at a uniform rate greater
than 2 Fmax Hz (Nyquist rate), or the frequency equal to twice the highest
frequency of x(t).
Fs 2 Fmax
SAMPLING RATE CONVERSION:
Sampling rate conversion is employed to generate a new sequence with a
sampling rate higher or lower than that of a given sequence. If x[n] is a
sequence with a sampling rate of F Hz and it is used to generate another
sequence y[n] with desired
alteration is given by,
F/F = R
ANTIALIASING
FILTER H (Z)
y[n]
0,
n = 0, 1, 2 .
otherwise
The sampling rate of y[n] is L times that of x[n]. The unwanted images in the
spectra of sampled signal must be removed by a LPF called anti-imaging filter.
The input sequence is passed through an anti-imaging filter after up sampling.
x[n]
LIBRARY FUNCTIONS:
resample: Changes sampling rate by any rational factor.
y = resample (x,p,q) resamples the sequence in vector x at p/q times the original
sampling rate, using a polyphase filter implementation. p and q must be positive
integers. The length of y is equal to ceil (length(x)*p/q).
interp:
(interpolation)
y = interp (x,r) increases the sampling rate of x by a factor of r. The interpolated
vector y is r times longer than the original input x. interp performs low pass
interpolation by inserting zeros into the original sequence and then applying a
special low pass filter.
upsample: Increases the sampling rate of the input signal
y = upsample(x,n) increases the sampling rate of x by inserting n-1 zeros
between samples. The upsampled y has length(x)*n samples
decimate:
Decreases
the
sampling
rate
for
sequence
(decimation).
y = decimate (x, r) reduces the sample rate of x by a factor r. The decimated
vector y is r times shorter in length than the input vector x. By default, decimate
employs an eighth-order low pass Chebyshev Type I filter. It filters the input
sequence in both the forward and reverse directions to remove all phase
distortion, effectively doubling the filter order.
downsample: Decreases the sampling rate of the input signal
y = downsample(x,n) decreases the sampling rate of x by keeping every n th
sample starting with the first sample. The downsampled y has length(x)/n
samples
ALGORITHM/PROCEDURE:
1. Generate a sinusoidal waveform
2. Using the appropriate library function for interpolation ,decimation
,upsampling ,
downsampling and resampling, perform sampling rate conversion for the
sinusoidal waveform
3. Find the spectrum of all the signals and compare them in frequency
domain.
4. Display the resultant waveforms
Source code :
clc;
clear all;
close all;
%continuous sinusoidal signal
a=input('Enter the amplitude:');
f=input('Enter the Timeperiod:');
t=-10:1:20;
x=a*sin(2*pi*f*t);
subplot(2,3,1);
plot(t,x);
xlabel('time');
ylabel('Amplitude');
title('Sinusoidal signal');
%decimating the signal
d=input('Enter the value by which the signal is to be decimated:');
y1=decimate(x,d);
subplot(2,3,2);
stem(y1);
xlabel('time');
ylabel('Amplitude');
title('Decimated signal');
%interpolating the signal
i=input('Enter the value by which the signal is to be interpolated:');
y2=interp(x,i);
subplot(2,3,3);
stem(y2);
xlabel('time');
ylabel('Amplitude');
title('Interpolated signal');
%resampling the signal
y3=resample(x,3,2);
subplot(2,3,4);
stem(y3);
xlabel('time');
ylabel('Amplitude');
title('Resampled signal');
%downsampling the signal
y4=downsample(x,2);
subplot(2,3,5);
stem(y4);
xlabel('time');
ylabel('Amplitude');
title('Downsampled signal');
%upsampling the signal
y5=upsample(x,3);
subplot(2,3,6);
stem(y5);
xlabel('time');
ylabel('Amplitude');
title('Upsampled signal');
Output :
RESULT:
The program written using library functions and the sampling rate
conversion process is studied.
FLOWCHART:
START
STOP