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:

  1. 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.
  2.  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');
             
I  INPUT 1:
              Enter the frequency of carrier=100
              Enter the frequency of pulse=10
  
  OUTPUT GRAPH
ASK USING MATLAB
  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

ASK USING MATLAB
 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:


ASK USING MATLAB
               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:

ASK USING MATLAB
             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.




 






As an engineer we have to solve many high order equations. Sometimes the order is so high that we can’t find the ROOTS of the equation even by using CALCULATORS. In such a situation MATLAB is very efficient and effective.

CODE:

p=input('ENTER THE COEFFICIENTS OF THE POLYNOMIAL');
f=roots(p);
disp('THE ROOTS OF THE EQUATION ARE:');
disp(f)

Examples:


For this polynomial input is:


          P=[1 -12 4 0 -5 -2 94 -32 -12 45]

OUTPUT:

              THE ROOTS OF THE EQUATION ARE:

  11.6598         
  -1.2030 + 0.8796i
  -1.2030 - 0.8796i
   0.4369 + 1.4779i
   0.4369 - 1.4779i
   1.5296         
  -0.7256         
   0.5342 + 0.6114i
   0.5342 - 0.6114i



For this polynomial input is:


           P=[15 84 4 -5 -2 94 -32 -12 45]

OUTPUT:

             THE ROOTS OF THE EQUATION ARE:

  -5.5489         
  -0.8019 + 0.8659i
  -0.8019 - 0.8659i
  -0.7011         
   0.4075 + 0.7577i
   0.4075 - 0.7577i
   0.7195 + 0.4800i
   0.7195 - 0.4800i


For this polynomial input is:


           P=[94 -15 -932 59 -132 -1267 45]

OUTPUT:

                THE ROOTS OF THE EQUATION ARE:

   3.2795         
  -3.0503         
   0.5016 + 0.9842i
   0.5016 - 0.9842i
  -1.1083         
   0.0354
In this modulation technique the frequency and the phase of the message signal remains constant and the value of amplitude gets modulated. Here, the carrier signal is taken as a very high frequency signal.  The amount of modulation depends on the MODULATION INDEX ‘m’ and the CARRIER FREQUENCY ‘fc’.

MATLAB CODE FOR MODULATION INDEX 0.5.



a=input('ENTER THE AMPLITUDE OF SIGNAL');
b=input('ENTER THE AMPLITUDE OF CARRIER SIGNAL');
fm=input('ENTER THE FREQUENCY OF MESSAGE SIGNAL');
fc=input('ENTER THE FREQUENCY OF CARRIER SIGNAL');
x = 0:0.001:1;
m=0.5;
sm=a*sin(2*pi*fm*x);
sc=b*sin(2*pi*fc*x);
smod=(a+m*sm).*sin(2*pi*fc*x)
subplot(3,1,1),plot(x,sm)
title('MESSAGE SIGNAL');
subplot(3,1,2),plot(x,sc)
title('CARRIER SIGNAL');
subplot(3,1,3),plot(x,smod)
title('AMPLITUDE MODULATED SIGNAL');


OUTPUT

CASE 1:

AMPLITUDE OF SIGNAL  - 5
AMPLITUDE OF CARRIER SIGNAL - 5
FREQUENCY OF MESSAGE SIGNAL - 5
FREQUENCY OF CARRIER SIGNAL – 50
AMPLITUDE MODULATION MATLAB GRAPH

CASE 2:

AMPLITUDE OF SIGNAL - 5
AMPLITUDE OF CARRIER SIGNAL - 10
FREQUENCY OF MESSAGE SIGNAL - 5
FREQUENCY OF CARRIER SIGNAL – 50

AMPLITUDE MODULATION MATLAB GRAPH

MATLAB CODE FOR VARIOUS MODULATION INDEX.


Here we have to find the AMPLITUDE MODULATED signal for different MODULATION INDEXES and plot them in the same graph using ‘subplot’ command. The modulation indexes are 0.15, 0.3, 0.5 and 0.8.

a=input('ENTER THE AMPLITUDE OF SIGNAL');
b=input('ENTER THE AMPLITUDE OF CARRIER SIGNAL');
fm=input('ENTER THE FREQUENCY OF MESSAGE SIGNAL');
fc=input('ENTER THE FREQUENCY OF CARRIER SIGNAL');
x = 0:0.001:1;
m1=0.15;
m2=0.3;
m3=0.5;
m4=0.8;
sm=a*sin(2*pi*fm*x);
sc=b*sin(2*pi*fc*x);
smod1=(a+m1*sm).*sin(2*pi*fc*x)
smod2=(a+m2*sm).*sin(2*pi*fc*x)
smod3=(a+m3*sm).*sin(2*pi*fc*x)
smod4=(a+m4*sm).*sin(2*pi*fc*x)
subplot(4,1,1),plot(x,smod1)
title('MODULATION INDEX 0.15');
subplot(4,1,2),plot(x,smod2)
title('MODULATION INDEX 0.3');
subplot(4,1,3),plot(x,smod3)
title('MODULATION INDEX 0.5');
subplot(4,1,4),plot(x,smod4)
title('MODULATION INDEX 0.8');



OUTPUT

CASE 3:

AMPLITUDE OF SIGNAL - 5
AMPLITUDE OF CARRIER SIGNAL - 10
FREQUENCY OF MESSAGE SIGNAL – 5Hz
FREQUENCY OF CARRIER SIGNAL – 50Hz
AMPLITUDE MODULATION MATLAB GRAPH

CASE 4:

AMPLITUDE OF SIGNAL - 5
AMPLITUDE OF CARRIER SIGNAL - 10
FREQUENCY OF MESSAGE SIGNAL – 7Hz
FREQUENCY OF CARRIER SIGNAL – 70Hz
AMPLITUDE MODULATION MATLAB GRAPH

APPLICATION

Amplitude modulation is utilized in many services such as television, standard broadcasting, aids to navigation, telemetering, radar, facsimile etc. Although the message content may vary widely for these, the mechanism of combining the message and the message carrier at the sending terminal is basically the same.
+