Amplitude-shift keying (ASK) is a form
of amplitude modulation that represents digital data as variations in the
amplitude of a carrier wave. Like AM, ASK is also linear and sensitive to
atmospheric noise, distortions, propagation conditions on different routes in
PSTN, etc. Both ASK modulation and demodulation processes are relatively
inexpensive. The ASK technique is also commonly used to transmit digital data
over optical fiber. For LED transmitters, binary 1 is represented by a short
pulse of light and binary 0 by the absence of light.
There are two ways in which we can do
ASK using MATLAB:
- ASK by square pulses: here we will the carrier frequency and frequency of square wave. From that we will generate a square function & carrier signal which is a sine wave and perform ASK.
- ASK by BIT stream: here we will give different bits i.e. ‘1’ or ‘0’ from that we will generate a signal and then perform the ASK.
ASK BY SQUARE PULSES - MATLAB CODE
clear all;
clc;
close all;
F1=input('Enter the frequency of carrier=');
F2=input('Enter the frequency of pulse=');
A=3; %Amplitude
t=0:0.001:1;
x=A.*sin(2*pi*F1*t); %Carrier Sine wave
u=A/2.*square(2*pi*F2*t)+(A/2); %Square wave
v =x.*u;
subplot(3,1,1);
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('Carrier');
subplot(3,1,2);
plot(t,u);
xlabel('Time');
ylabel('Amplitude');
title('Square Pulses');
subplot(3,1,3);
plot(t,v);
xlabel('Time');
ylabel('Amplitude');
title('ASK Signal');
clc;
close all;
F1=input('Enter the frequency of carrier=');
F2=input('Enter the frequency of pulse=');
A=3; %Amplitude
t=0:0.001:1;
x=A.*sin(2*pi*F1*t); %Carrier Sine wave
u=A/2.*square(2*pi*F2*t)+(A/2); %Square wave
v =x.*u;
subplot(3,1,1);
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('Carrier');
subplot(3,1,2);
plot(t,u);
xlabel('Time');
ylabel('Amplitude');
title('Square Pulses');
subplot(3,1,3);
plot(t,v);
xlabel('Time');
ylabel('Amplitude');
title('ASK Signal');
I INPUT 1:
Enter the frequency of carrier=100
Enter the frequency
of pulse=10
OUTPUT GRAPH
Fig 2: ASK modulated and demodulated signals for carrier frequency 100 Hz and square pulse frequency 10 Hz. |
INPUT 2:
Enter the frequency of carrier=70
Enter the frequency of pulse=5
OUTPUT
Fig 2: ASK modulated and demodulated signals for carrier frequency 70 Hz and square pulse frequency 5 Hz. |
ASK BY BIT STREAM - MATLAB CODE
clc;
clear all;
close all;
%carrier frequency and
amplitude
f=5;
a=1;
n = input('ENTER THE BIT STREAM:')
l=length(n);
if n(l)==1
n(l+1)=1
else
n(l+1)=0
end
l1=length(n)
tn=0:l1-1;
%plot message signal
subplot(4,1,1);
stairs(tn,n);
title('MESSAGE SIGNAL');
xlabel('TIME');
ylabel('AMPLITUDE');
%plot carrier signal
t=0:0.01:l;
y1=a*sin(2*pi*f*t);
subplot(4,1,2);
plot(t,y1);
title('CARRIER SIGNAL');
xlabel('TIME');
ylabel('AMPLITUDE');
%modulation process
for i=1:l
for j=(i-1)*100:i*100
if(n(i)==1)
s(j+1)=y1(j+1);
else
s(j+1)=0;
end
end
end
%plot ASK signal
subplot(4,1,3);
plot(t,s);
title('ASK MODULATED SIGNAL');
xlabel('TIME');
ylabel('AMPLITUDE');
%Demodulation process
for i=1:l
for j=(i-1)*100:i*100
if(s(j+1)==y1(j+1))
x(j+1)=1;
else
x(j+1)=0;
end
end
end
%plot demodulated signal
subplot(4,1,4);
plot(t,x);
title('ASK DEMODULATED SIGNAL');
xlabel('TIME');
ylabel('AMPLITUDE');
INPUT 3:
ENTER THE BIT STREAM:[1 0 0 1 1 1
1 0 0 0]
OUTPUT GRAPH:
Fig 3: ASK modulated and demodulated signal for [1 0 0 1 1 1 1 0 0 0] bit stream. |
INPUT 4:
ENTER THE BIT STREAM:[1 0 1 0 1 0
1 0 1 0 1 0 1 0 0 1 1]
OUTPUT GRAPH:
Fig 4: ASK modulated and demodulated signal for [1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1] bit stream. |