You are on page 1of 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