0% found this document useful (0 votes)
35 views3 pages

Delta: All All

The document contains MATLAB code to perform delta modulation and demodulation. It defines a sinusoidal signal, applies delta modulation to the signal using a step size, and plots the original, modulated, and demodulated signals. The code samples the signal, calculates the error from the previous sample, quantizes the error, and adds it to the previous quantized sample to generate the modulated output. It then demodulates the output by accumulating the quantized samples.

Uploaded by

Vikas Sharma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views3 pages

Delta: All All

The document contains MATLAB code to perform delta modulation and demodulation. It defines a sinusoidal signal, applies delta modulation to the signal using a step size, and plots the original, modulated, and demodulated signals. The code samples the signal, calculates the error from the previous sample, quantizes the error, and adds it to the previous quantized sample to generate the modulated output. It then demodulates the output by accumulating the quantized samples.

Uploaded by

Vikas Sharma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

DELTA

clc;
clear all;
close all;
t=0:0.01:1;
1m=8*sin(2*pi*t);
l=length(m);
d=(9*pi)/10;
for n=1:l
if n==1
e(n)=m(n);
eq(n)=d*sign(e(n));
mq(n)=eq(n);
else
e(n)=m(n)-mq(n-1);
eq(n)=d*sign(e(n));
mq(n)=eq(n)+mq(n-1);
end
end
subplot(3,1,1);
plot(m);
ylabel('amplitude--->');
xlabel('time--->');
grid on;
hold on;
subplot(3,1,2);
plot(m,'r');
hold on;
stairs(mq);
ylabel('amplitude--->');
xlabel('time--->');
grid on;
%demodulation
for n=1:l
if n==1
mr(n)=mq(n);
else
mr(n)=mq(n)+mq(n-1);
end
end
subplot(3,1,3);
plot(mr);
grid on;
ylabel('amplitude--->');
xlabel('time--->');

ASK

clc;

close all;
clear all;
x=[1 0 1 1 0 1];
f=30;
l=length(x);
%input sequence
for i=1:l
amp=x(1,i);
for t=(i-1)*100+1:i*100
inp(t)=amp;
end
end
subplot(3,1,1);
plot(inp);
title('input sequence');
axis([1 t -2 2]);
grid on;
ylabel('amplitude--->');
xlabel('time--->');
%ask modulation signal
for i=1:l
amp=x(1,i);
for t=(i-1)*100+1:i*100
inp(t)=amp*cos(2*pi*f*t/1000);
end
end
subplot(3,1,2);
plot(inp);
title('ask signal');
axis([1 t -2 2]);
grid on;
ylabel('amplitude--->');
xlabel('time--->');
%ask demodulation signal
for i=1:l
amp=x(1,i);
for t=(i-1)*100+1:i*100
inp(t)=amp*cos(2*pi*f*t/1000);
if inp(t)==0
d(t)=0;
else
d(t)=1;
end
end
end
subplot(3,1,3);
plot(d);
title('recovered signal');
axis([1 t -2 2]);
grid on;
ylabel('amplitude--->');
xlabel('time--->');

You might also like