EXPERIMENT NO:1
AMPLITUDE MODULATION
clc;
clear all;
t=-5:0.001:5;
x=sin(2*pi*.2*t);
y=cos(2*pi*4*t);
m=input('enter the modulation index');
z=m*x;
s=y+y.*z;
subplot(3,1,1)
plot(t,x)
xlabel('time')
ylabel('Amplitude')
title('Modulating signal')
subplot(3,1,2)
plot(t,y)
xlabel('time')
ylabel('Amplitude')
title('Carrier signal')
subplot(3,1,3)
plot(t,s)
xlabel('time')
ylabel('Amplitude')
title('Amplitude Modulated signal')
EXPERIMENT NO:2
FREQUENCY MODULATION
clc;
clear all;
t=-5:0.001:5;
fm=input('enter the modulating signal Frequency')
%fm=0.2;
x=sin(2*pi*fm*t);
fc=input('enter the carrier signal Frequency')
%fc=4;
y=cos(2*pi*fc*t);
m=input('enter the modulation index');
%m=10;
z=m*x;
s=cos(2*pi*fc*t+z);
subplot(3,1,1)
plot(t,x)
xlabel('time')
ylabel('Amplitude')
title('Modulating signal')
subplot(3,1,2)
plot(t,y)
xlabel('time')
ylabel('Amplitude')
title('Carrier signal')
subplot(3,1,3)
plot(t,s)
xlabel('time')
ylabel('Amplitude')
title('Frequency Modulated signal')
EXPERIMENT NO:3
AMPLITUDE SHIFT KEYING
clc;
clear all;
close all;
%GENERATE CARRIER SIGNAL
Tb=1; fc=10;
t=0:Tb/100:1;
c=sqrt(2/Tb)*sin(2*pi*fc*t);
%generate message signal
N=8;
m=rand(1,N);
t1=0;t2=Tb
for i=1:N
t=[t1:.01:t2]
if m(i)>0.5
m(i)=1;
m_s=ones(1,length(t));
else
m(i)=0;
m_s=zeros(1,length(t));
end
message(i,:)=m_s;
%product of carrier and message
ask_sig(i,:)=c.*m_s;
t1=t1+(Tb+.01);
t2=t2+(Tb+.01);
%plot the message and ASK signal
subplot(5,1,2);axis([0 N -2 2]);plot(t,message(i,:),'r');
title('message signal');xlabel('t--->');ylabel('m(t)');grid on
hold on
subplot(5,1,4);plot(t,ask_sig(i,:));
title('ASK signal');xlabel('t--->');ylabel('s(t)');grid on
hold on
end
hold off
%Plot the carrier signal and input binary data
subplot(5,1,3);plot(t,c);
title('carrier signal');xlabel('t--->');ylabel('c(t)');grid on
subplot(5,1,1);stem(m);
title('binary data bits');xlabel('n--->');ylabel('b(n)');grid on
EXPERIMENT NO:4
FREQUENCY SHIFT KEYING
clc;
clear all;
close all;
%GENERATE CARRIER SIGNAL
Tb=1; fc1=2;fc2=5;
t=0:(Tb/100):Tb;
c1=sqrt(2/Tb)*sin(2*pi*fc1*t);
c2=sqrt(2/Tb)*sin(2*pi*fc2*t);
%generate message signal
N=8;
m=rand(1,N);
t1=0;t2=Tb
for i=1:N
t=[t1:(Tb/100):t2]
if m(i)>0.5
m(i)=1;
m_s=ones(1,length(t));
invm_s=zeros(1,length(t));
else
m(i)=0;
m_s=zeros(1,length(t));
invm_s=ones(1,length(t));
end
message(i,:)=m_s;
%Multiplier
fsk_sig1(i,:)=c1.*m_s;
fsk_sig2(i,:)=c2.*invm_s;
fsk=fsk_sig1+fsk_sig2;
%plotting the message signal and the modulated signal
subplot(3,2,2);axis([0 N -2 2]);plot(t,message(i,:),'r');
title('message signal');xlabel('t---->');ylabel('m(t)');grid on;hold on;
subplot(3,2,5);plot(t,fsk(i,:));
title('FSK signal');xlabel('t---->');ylabel('s(t)');grid on;hold on;
t1=t1+(Tb+.01); t2=t2+(Tb+.01);
end
hold off
%Plotting binary data bits and carrier signal
subplot(3,2,1);stem(m);
title('binary data');xlabel('n---->'); ylabel('b(n)');grid on;
subplot(3,2,3);plot(t,c1);
title('carrier signal-1');xlabel('t---->');ylabel('c1(t)');grid on;
subplot(3,2,4);plot(t,c2);
title('carrier signal-2');xlabel('t---->');ylabel('c2(t)');grid on;
EXPERIMENT NO:5
PHASE SHIFT KEYING
clc;
clear all;
close all;
%GENERATE CARRIER SIGNAL
Tb=1;
t=0:Tb/100:Tb;
fc=2;
c=sqrt(2/Tb)*sin(2*pi*fc*t);
%generate message signal
N=8;
m=rand(1,N);
t1=0;t2=Tb
for i=1:N
t=[t1:.01:t2]
if m(i)>0.5
m(i)=1;
m_s=ones(1,length(t));
else
m(i)=0;
m_s=-1*ones(1,length(t));
end
message(i,:)=m_s;
%product of carrier and message signal
bpsk_sig(i,:)=c.*m_s;
%Plot the message and BPSK modulated signal
subplot(5,1,2);axis([0 N -2 2]);plot(t,message(i,:),'r');
title('message signal(POLAR form)');xlabel('t--->');ylabel('m(t)');
grid on; hold on;
subplot(5,1,4);plot(t,bpsk_sig(i,:));
title('BPSK signal');xlabel('t--->');ylabel('s(t)');
grid on; hold on;
t1=t1+1.01; t2=t2+1.01;
end
hold off
%plot the input binary data and carrier signal
subplot(5,1,1);stem(m);
title('binary data bits');xlabel('n--->');ylabel('b(n)');
grid on;
subplot(5,1,3);plot(t,c);
title('carrier signal');xlabel('t--->');ylabel('c(t)');
grid on;
EXPERIMENT NO:6
DTMF
% CLEARING PREVIOUS CONTENTS
clc;
clear all;
close all;
% ASSIGNING THE FREQUENCIES TO 'X' AND 'Y'
number=input('enter the number in single quotes :') ;
L=length(number);
t=[0:0.0001:0.05]'; % t (time vector) is a column matrix
x=2*pi*[697 770 852 941];% fixed freq for rows of dial pad
y=2*pi*[1209 1336 1477];% fixed freq for columns
tx=[sin(x(1)*t) sin(x(2)*t) sin(x(3)*t) sin(x(4)*t)];
ty=[sin(y(1)*t) sin(y(2)*t) sin(y(3)*t)];
% SWITCH STATEMENT TO SELECT THE NUMBERS DIALED
for i=1:1:L
switch number(i)
case'1'
tone=tx(:,1)+ty(:,1);
%sound(tone);
stem(tone);title(' tone for number 1');
case'2'
tone=tx(:,1)+ty(:,2);
%sound(tone);
stem(tone);title(' tone for number 2');
case'3'
tone=tx(:,1)+ty(:,3);
%sound(tone);
stem(tone);title(' tone for number 3');
case'4'
tone=tx(:,2)+ty(:,1);
%sound(tone);
stem(tone);title(' tone for number 4');
case'5'
tone=tx(:,2)+ty(:,2);
%sound(tone);
stem(tone);title(' tone for number 5');
case'6'
tone=tx(:,2)+ty(:,3);
%sound(tone);
stem(tone);title(' tone for number 6');
case'7'
tone=tx(:,3)+ty(:,1);
%sound(tone);
stem(tone);title(' tone for number 7');
case'8'
tone=tx(:,3)+ty(:,2);
%sound(tone);
stem(tone);title(' tone for number 8');
case'9'
tone=tx(:,3)+ty(:,3);
%sound(tone);
stem(tone);title(' tone for number 9');
case'*'
tone=tx(:,4)+ty(:,1);
%sound(tone);
stem(tone);title(' tone for *');
case'0'
tone=tx(:,4)+ty(:,2);
%sound(tone);
stem(tone);title(' tone for number 0');
case'#'
tone=tx(:,4)+ty(:,3);
%sound(tone);
tem(tone);title(' tone for #');
otherwise
disp('invalid number');
sound(sin(2*pi*5600*t));
end; %end of switch statement
pause(1) % delay between successive tones
end;%end of for loop