0% found this document useful (0 votes)
51 views4 pages

DC Lab Assignment#1

This document discusses converting an analog signal to a digital signal. It describes the key steps as sampling, quantization, and encoding. Sampling involves taking periodic samples of the analog signal. Quantization takes the sampled analog values and converts them to discrete digital values by dividing the signal into a set number of levels. Encoding then converts the quantized digital values into binary form. The document includes MATLAB code that implements these steps to convert a sinusoidal analog signal to a digital representation and plots the original and converted signals.
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)
51 views4 pages

DC Lab Assignment#1

This document discusses converting an analog signal to a digital signal. It describes the key steps as sampling, quantization, and encoding. Sampling involves taking periodic samples of the analog signal. Quantization takes the sampled analog values and converts them to discrete digital values by dividing the signal into a set number of levels. Encoding then converts the quantized digital values into binary form. The document includes MATLAB code that implements these steps to convert a sinusoidal analog signal to a digital representation and plots the original and converted signals.
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

FOUNDATION UNIVERSITY RAWALPINDI CAMPUS

ELECTRICAL ENGINEERING DEPARTMENT


MATERIAL SCIENCE
ASSIGNMENT # 1

NAME: SHAH ZEB


REG # 067
SECTION: BSEE-6B

DATE: 27-03-2017

SUBMITTED TO: Eng. Fawad Khan


CONVERTING ANALOGUE SIGNAL TO DIGITAL SIGNAL
INTRODUCTION
An analogue to digital convertor is a device which converts analogue signal to digital signal with
a given accuracy and resolution.

PROCESS
To convert analogue to digital signal the following are the process:
1. Sampling
2. Quantization
3. Encoding
SAMPLING:
In this process the analogue signal is sampled over a period of time. To sample the analogue,
signal the continuous signal should be greater or equal to 2fmax i.e.; fs 2fmax.

QUANTIZATION:
It takes the sample analogue values and converts it to digital values. It is limited to 2-bits. There
are certain levels of Quantization. Quantization error increases with the decreasing the levels.
To calculate the quantization levels we use

2 where n = bits

Step Size = Vref/2^n-1

MATLAB CODE FO A/D CONVERTOR


% Convert an Anologue Signal to Digital signal by using the following steps
% 1. Sampling
% 2. Quantization
% 3.Encoding
%Then plot the signal
% NAME: Shah Zeb
% REG#:F141BBSEE067
% BSEE-6B
%%
clc;
close all;

%% set time vector and freqeuncy for "continous-time" sinusoidal signal


tMax = 5; %Maximum Time Period
t = 0:0.01:tMax;
f = 2; %Freqeuncy

%% set sampling rate for sampled sinusoid


fs = 5; %Sampled Freqeuncy
tSamp = 0:1/fs:tMax;

%% create "continous" and sampled signals


xCont = sin(2*pi*f*t); %Continuous Signal
xSamp = sin(2*pi*f*tSamp); %Sampled Signal

hold on;
subplot(2,1,1);

plot(t,xCont,'b','linewidth',2);

hold on;
plot(tSamp,xSamp,'ko','linewidth',2);

subplot(2,1,2);

%% quantization of the signals


n = 3; %Levels
q = f/(2.^n-1); %Quantization Level
y = abs(xCont); %Absolute Value
x0 = fix(y/q); %Round to nearest value

%% encoding of signal
y0 = dec2bin(x0,n); %Convert Decimal no. to Binary no.
y1 = x0*q;

%% plotting of digital signal


plot(t,y1,'g','linewidth',2);
MATLAB OUTPUT

You might also like