Professional Documents
Culture Documents
Lab Title: Sampling Rate Conversion: Air University
Lab Title: Sampling Rate Conversion: Air University
EXPERIMENT NO 9
Objective . The goal of this laboratory is to perform sampling rate conversion for any given
arbitrary sequence (D.T) or signal (C.T) by interpolation, decimation, up sampling, down
sampling and resampling(i.e. fractionalvalue
LAB ASSESSMENT:
Data presentation
1 Objectives:
. The goal of this laboratory is to perform sampling rate conversion for any given arbitrary sequence
(D.T) or signal (C.T) by interpolation, decimation, up sampling, down sampling and resampling(i.e.
fractionalvalue)
2 Time Required: 3 hrs
.
3 Programming Language: MATLAB
.
4 Software Required:
. (a). MATLAB 7 or above
Task 1:
clc;
clear all;
close all;
%continuous sinusoidal signal
a=input('Enter the amplitude:');
f=input('Enter the Frequency:');
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');
Command window:
output
Task 4:
Part 1:
Code:
clc;
clear all;
close all;
%continuous sinusoidal signal
a=input('Enter the amplitude:');
f=input('Enter the Frequency:');
t=-10:1:20;
x=a*sin(2*pi*f*t);
plot(t,x);
xlabel('time');
ylabel('Amplitude');
title('Sinusoidal signal');
T=0.016;
n=0:T:1;
xs=cos(2*pi*f*n);
k=0:length(n)-1;
stem(k,xs,'r');
Command window:
Output:
Part 2:
Code:
clc;
clear all;
close all;
%continuous sinusoidal signal
a=input('Enter the amplitude:');
f=input('Enter the Frequency:');
t=-10:1:20;
x=a*sin(2*pi*f*t);
subplot(3,3,1);
plot(t,x);
xlabel('time');
ylabel('Amplitude');
title('Sinusoidal signal');
T=0.016;
n=0:T:1;
Xa=cos(2*pi*f*n);
k=0:length(n)-1
plot(k,Xa,'r');
xlabel('Time Index n');
ylabel('Amlitude');
title('Discrete Time Signal');
%decimating the signal
d=input('Enter the value by which the signal is to be decimated:');
y1=decimate(x,d);
subplot(3,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(3,3,3);
stem(y2);
xlabel('time');
ylabel('Amplitude');
title('Interpolated signal');
%resampling the signal
y3=resample(x,3,4);
subplot(3,3,4);
stem(y3);
xlabel('time');
ylabel('Amplitude');
title('Resampled signal');
%downsampling the signal
y4=downsample(x,2);
subplot(3,3,5);
stem(y4);
xlabel('time');
ylabel('Amplitude');
title('Downsampled signal');
%upsampling the signal
y5=upsample(x,3);
subplot(3,3,6);
stem(y5);
xlabel('time');
ylabel('Amplitude');
title('Upsampled signal');
Command window:
Enter the amplitude:1
Columns 1 through 16
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Columns 17 through 32
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Columns 33 through 48
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
Columns 49 through 63
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
>>
>>
>>
Output: