Sie sind auf Seite 1von 8

# EXPERIMENT NO.

: 6

DATE: 14/09/2011

AIM:
  
  
         
   
  

  !"!#\$

THEORY:
   
   
%     
    
   ! &  ' 


'   ' 
( 
)   
 
* !*c\$

& 
+c!&
+c\$!'
  

  
 &'

 '   
 
  
  
! 
 &  

 !
   !c,, )    !' -   
   
 ' 
'   
   
( 

&


  

  
 
       





!!

 
 (\$ 
 ' %     '  
&
 &
     
.

 
 
&   & &  ! '    
  '  
 

  
/ %  
  
' 
&&   & 
!

  
  
' 
&&   & 

ODE:
1. Rectangular QAM

clc;
clear all;
close all;
N=5000;
rem=mod(N,3);
m=randint(1,N);
m=[m zeros(1,3-rem)];
n=length(m)/3;
m1=reshape(m,3,n);
m1=2*m1-1;
t=linspace(0,1,N);

c 


1=2;
c1=cos(2*pi*1*t);
c2=sin(2*pi*1*t);
A1=sum(c1.^2);
A2=sum(c2.^2);
c1=(1/sqrt(A1)).*cos(2*pi*1*t);
c2=(1/sqrt(A2)).*sin(2*pi*1*t);
x1=m1(1,:);
x2=m1(2,:);
x3=m1(3,:);
y=[];
or i=1:n
i x1(i)==-1
y1=x2(i)*c1+x3(i)*c2;
y=[y y1];
else
y1=x2(i)*(4*c1)+x3(i)*c2;
y=[y y1];
end
end
Sd=input('Enter noise variance:')
e=Sd*randn(1,length(y));
r=y+e;
t1=length(t);
R=reshape(r,t1,n);
r1=c1*R;
r2=c2*R;
RR=[0 1 1;1 1 1;0 0 1;1 0 1;0 0 0;1 0 0;0 1 0;1 1 0];
or i=1:length(r1)
d1=sqrt((1-r1(i))^2+(1-r2(i))^2);
d2=sqrt((4-r1(i))^2+(1-r2(i))^2);
d3=sqrt((-1-r1(i))^2+(1-r2(i))^2);
d4=sqrt((-4-r1(i))^2+(1-r2(i))^2);
d5=sqrt((-1-r1(i))^2+(-1-r2(i))^2);
d6=sqrt((-4-r1(i))^2+(-1-r2(i))^2);
d7=sqrt((1-r1(i))^2+(-1-r2(i))^2);
d8=sqrt((4-r1(i))^2+(-1-r2(i))^2);
k=[d1,d2,d3,d4,d5,d6,d7,d8];
[C,I] = min(k);
z=I;
c


end
subplot(4,1,4)
title('Demodulated sequence')
axis([0 rL 0 1])
igure
plot(r1,r2,'*');
title('Constellation diagram or sigma=0.1')
xlabel('In-phase Component');


## 2. rcular QAM

clc;
clear all;
close all;
N=5000;
rem=mod(N,3);
msg=randint(1,N);
m=[msg zeros(1,3-rem)];
n=length(m)/3;
m1=reshape(m,3,n);
m1=2*m1-1;
igure
subplot(4,1,1)
stem(msg)
title('Message sequence')
t=linspace(0,1,N);
t1=length(t);
1=2;
c1=cos(2*pi*1*t);
c2=sin(2*pi*1*t);
A1=sum(c1.^2);
A2=sum(c2.^2);
c1=(1/sqrt(A1)).*cos(2*pi*1*t);
c2=(1/sqrt(A2)).*sin(2*pi*1*t);
x1=m1(:,1);
x2=m1(:,2);
x3=m1(:,3);
c0


y=[];
or i=1:n
i x1(i)==-1
y1=x2(i)*c1+x3(i)*c2;
y=[y y1];
else
y1=x2(i)*(4*c1)+x3(i)*(4*c2);
y=[y y1];
end
end
yL=length(y);
subplot(4,1,2)
plot(y)
title('QAM Signal');
xlabel('Time------>');
ylabel('Amplitude in Volts------>');
axis([0 yL -0.5 0.5])
Sd=input('Enter standard deviation value')
e=Sd*randn(1,yL);
r=y+e;
subplot(4,1,3)
plot(r)
xlabel('time------>')
ylabel('Amplitude in volts------>')
R=reshape(r,t1,n);
r1=c1*R;
r2=c2*R;
RR=[0 1 1;1 1 1;0 0 1;1 0 1;0 0 0;1 0 0;0 1 0;1 1 0];
or i=1:length(r1)
d1=sqrt((1-r1(i))^2+(1-r2(i))^2);
d2=sqrt((4-r1(i))^2+(4-r2(i))^2);
d3=sqrt((-1-r1(i))^2+(1-r2(i))^2);
d4=sqrt((-4-r1(i))^2+(4-r2(i))^2);
d5=sqrt((-1-r1(i))^2+(-1-r2(i))^2);
d6=sqrt((-4-r1(i))^2+(-4-r2(i))^2);
d7=sqrt((1-r1(i))^2+(-1-r2(i))^2);
d8=sqrt((4-r1(i))^2+(-4-r2(i))^2);
k=[d1,d2,d3,d4,d5,d6,d7,d8];
[C,I] = min(k);
z=I;
"


end
subplot(4,1,4)
title('Demodulated sequence')
axis([0 rL 0 1])
igure
plot(r1,r2,'*');
title('Constellation diagram or sigma=0.5')
xlabel('In-phase Component');



PLOTS:


" 


SIGNAL ONSTELLATION:

1. Rectangular QAM




"c



2. cular QAM




""



RESULT:
2 
  
     
  
  

 
"1
