0% found this document useful (0 votes)
42 views7 pages

Digital Signal Processing Lab Report

The document discusses digital signal processing and describes a lab experiment on sampling and reconstruction of continuous time signals using different techniques in MATLAB. The objectives are to construct analog signals from digital signals and compare different interpolation schemes. The methodology section explains the process of sampling, quantization, encoding, decoding and reconstruction. Linear and cubic interpolation techniques are implemented and compared. It is concluded that cubic spline interpolation produces better results.

Uploaded by

ahmararshad420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views7 pages

Digital Signal Processing Lab Report

The document discusses digital signal processing and describes a lab experiment on sampling and reconstruction of continuous time signals using different techniques in MATLAB. The objectives are to construct analog signals from digital signals and compare different interpolation schemes. The methodology section explains the process of sampling, quantization, encoding, decoding and reconstruction. Linear and cubic interpolation techniques are implemented and compared. It is concluded that cubic spline interpolation produces better results.

Uploaded by

ahmararshad420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

DIGITAL SIGNAL PROCESSING

Name: AHMAR ARSHAD

Registration Number: FA19-BEE-106

TITLE: LAB REPORT 7

Instructor’s Name: MIAN AHMAD YASSER


LAB # 8: To manipulate Sampling and reconstruction of
continuous time signals, different Sampling and Interpolation
techniques using MATLAB and SIMULINK
Objectives:
 To construct and sketch analog signal from digital signal
 To construct and sketch the effect of different interpolation schemes

Requirements:
Software:
 MATLAB
Methodology:
 The reconstruction of signaling for analog signals for bandwidth
signaling was discussed in this lab.
 We handle digital to analog conversion during the reconstruction
process.
 In this procedure, a decoder then reconstruction filter passes the received
digital signal to acquire the retrieved analog signal.
 Zero-order hold, linear interpolation and ideal interpolation might be
employed using three distinct ways.
 The optimum outcome is a smooth curve, with ideal interpolation.
 I received an analog signal in the first lab task I sampled and quantified
the signal at 16 levels using MATLAB SIMULINK.
 I subsequently encoded the binary signal.
 At the receiving end, I decoded the signal and reconstructed the signal
and displayed the results.
 I implemented linear diameter and cubic diameter interpolation in
MATLAB code for my second challenge.
 I compared the two techniques of reconstruction.
 I have sampled the signal supplied and have quantized and encoded the
8-bit signal.
 Then, with the two ways I decoded and recreated and compared the
signal.
Results and Conclusion:
I learnt about digital ADC analogue and DAC analog conversion in this
workshop. I have succeeded in sampling, quantifying, encoding, decoding and
reconstruction of the signal supplied. As a result, I learned that interpolation of
the cubic spline produces better results than interpolation of the linear spline. I
learnt to utilize the commands Interp1 and Spline.
Lab Task:

Task 1:
Solution:
clc;
clear all;
close all;
f = input('Enter the frequency of signal = '); % f - The frequency of analog sinosoid signal
F = input('Enter the sampling frequency = '); % F - Sampling Rate
A = input('Enter max amplitude of signal = '); % A - Amplitude of sinusoid signal
qbits = input('Enter the number of quantization bits = '); % qbits - Number of Quantizations
bits
fc = input('Enter the lowpass filter cutoff frequency = ');
L = 2^qbits; % L - Number of quantization levels based on qbits
I = 2*A/(L-1); % I - Quantization Interval

% Settings for Spectrum Scope


span = 8*F; % span - x-axis range of frequency plot 1 & 3 (spectrum scope 1 & 3)
span1 = 8*F; % span1 - x-axis range of frequency plot 2 (spectrum scope 2)
NFFT = 256;
% To run simulink model
t = 1/f;
sim_time = 10*t; % sim_time - Simultaion Time
sim('sampling15.slx') ;
spectrum original signal spectrum reconstructed signal
TASK 2:
clc
clear all
close all
t=0:0.001:1
fm=10
fs=1000
N=8
L=2.^N
%message signals
x=sin(2*pi*fm*t)
figure
subplot 211
plot(t,x)
title('message signal')
xlabel('time')
ylabel('amplitude')
%pulse traain
d=0:1/50:1
y=pulstran(t,d,'rectpuls',0.001) %Use the pulstran function to generate a train of custom
pulses. The train is sampled at 2 kHz for 1.2 seconds
subplot 212
plot(t,y)
title('pulse train')
xlabel('time')
ylabel('amplitude')
%sampling
z=x.*y
figure
subplot 211
plot(t,z)
title('sampled signal')
xlabel('time')
ylabel('amplitude')
%quantization
D=[max(x)-min(x)]/(L-1)
xq=quant(x,D)
subplot 212
plot(t,xq)
title('quantized signal')
xlabel('time')
ylabel('amplitude')

%encoder
H_e=dsp.UniformEncoder(max(xq),N) %Encoding is the process of using various patterns
of voltage or current levels to represent 1s and 0s of the digital signals on the transmission
link.
encoder=step(H_e,xq)
figure
subplot 211
plot(t,encoder)
title('encoded signal')
xlabel('time')
ylabel('amplitude')
%decoder
H_d=dsp.UniformDecoder(max(xq),N) %The decode function aims to recover messages that
were encoded using an error-correction coding technique.
decoder=step(H_d,encoder)
subplot 212
plot(t,decoder)
title('decoded sig')
xlabel('time')
ylabel('amplitude')
%interpolation
time=0:1/(2*fs):5
interpolation=interp1(t,decoder,time) %Interpolation is a technique for adding new data
points within a range of a set of known data points.
figure
subplot 211
plot(time,interpolation)
title('interpolation')
%SC interpolation This MATLAB function returns a vector of interpolated values s
corresponding to the query points in xq.
subplot 212
xx=0:0.001:1
sc=spline(t,x,xx)
plot(t,sc)
title('spline interpolation')

You might also like