Anda di halaman 1dari 4

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

Anda mungkin juga menyukai