5 A &B Delta Modulation and Adaptive Delta Modulation

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

5 A &B

DELTA MODULATION AND ADAPTIVE DELTA MODULATION

AIM
To simulate the Delta and Adaptive delta modulation using Mat lab.
TOOLS REQUIRED:
Simulation : Matlab 7.0 or higher version
ALGORITHM:
Step: 1: Start the program
Step: 2: Get the length of the sinusoidal signal
Step: 3: Compute the step size
Step: 4: Plot the output sequence
Step: 5: Terminate the process
PROGRAM :
DELTA MODULATION:
% function to generate Linear Delta Modulation for sinwave
% generating sinwave
t=[0:2*pi/100:2*pi];
a=10*sin(t);
n=length(a);
dels=1;
xhat(1:n)=0;
x(1:n)=a;
d(1:n)=0;
%

Linear Delta Modulation


for k=1: n
if (x(k)-xhat(k)) > 0
d(k)=1;
else d(k)=-1;

end %if
xtilde(k)=xhat(k)+d(k)*dels;
xhat(k+1)=xtilde(k);
end %k
%Prints
figure(1); hold on;
plot(a)
plot(xhat);
plot(d-15);
axis([0 100 -20 20])
OUTPUT:
20
15
10
5
0
-5
-10
-15
-20

10

20

30

40

50

60

70

80

90

100

PROGRAM :
ADAPTIVE DELTA MODULATION:
% adaptive delta modulation for sinwave
% Generating sin wave
t=[0:2*pi/100:2*pi];
a=10*sin(t);
n=length(a);
mindels=1;
dels(1:n)=mindels;
xhat(1:n)=0;
x(1:n)=a;
% Adaptive

Delta Modulation

d(1:n)=1;
for k=2:n
if ((x(k)-xhat(k-1)) > 0 )
d(k)=1;
else d(k)=-1;
end %if
if k==2
xhat(k)=d(k)*mindels+xhat(k-1);
end
if ((xhat(k)-xhat(k-1)) > 0)
if (d(k-1)

== -1 &d(k) ==1)

xhat(k+1)=xhat(k)+0.5*(xhat(k)-xhat(k-1));
elseif (d(k-1)

== 1 &d(k) ==1)

xhat(k+1)=xhat(k)+1.15*(xhat(k)-xhat(k-1));

elseif (d(k-1)

== 1 &d(k) ==-1)

xhat(k+1)=xhat(k)-0.5*(xhat(k)-xhat(k-1));
elseif (d(k-1)

== -1 &d(k) ==-1)

xhat(k+1)=xhat(k)-1.15*(xhat(k)-xhat(k-1));
end
else
if (d(k-1)

== -1 &d(k) ==1)

xhat(k+1)=xhat(k)-0.5*(xhat(k)-xhat(k-1));
elseif (d(k-1)

== 1 &d(k) ==1)

xhat(k+1)=xhat(k)-1.15*(xhat(k)-xhat(k-1));
elseif (d(k-1)

== 1 &d(k) ==-1)

xhat(k+1)=xhat(k)+0.5*(xhat(k)-xhat(k-1));
elseif (d(k-1)

== -1 &d(k) ==-1)

xhat(k+1)=xhat(k)+1.15*(xhat(k)-xhat(k-1));
end
end
end
%Plots
figure(1);hold on;
plot(a);
plot(xhat);
plot(d-15)

OUTPUT:

15
10
5
0
-5
-10
-15
-20

20

40

60

80

100

120

RESULT:
Thus the Mat lab program was simulated for delta and adaptive modulation the
waveforms are plotted.

You might also like