Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
apsk matlab code
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Duplicate Threads
View previous topic :: View next topic  
Author Message
amran_aiub
n00b
n00b


Joined: 24 Oct 2011
Posts: 2

PostPosted: Mon Oct 24, 2011 6:33 pm    Post subject: apsk matlab code Reply with quote

hello everyone,
i am in deep problem in apsk matlab code. i have a code but there is an error , i cant find out this. plz if anybody has some idea plz help me.
here is the code:
clc;
clear all;
close all;
%%%%%%%%%%%%%%%%%% ϵͳ²ÎÊýÉèÖà %%%%%%%%%%%%%%%%%%%%%%%%%%%%
N=10000;
M=16;
R=0.45; %16PSKÐźŷù¶È£¬ÆäËûÁ½¸öÐźžùÒÔ´ËΪ²Î¿¼£¬ÒÔ±£Ö¤ÊäÈëÐźŹ¦ÂÊÏàͬ
alpha=1.13; %16apskÐźÅÍâΧ·ù¶È±ÈÀý(ÓëpskÐźŶԱÈ)
beta=0.95; %16qamÐźÅÍâΧʵ²¿·ù¶È±ÈÀý
v=sqrt(-1);
ratio=1.7; % TWTA·Å´ó±ÈÀý ÈÏΪÔÚ½âµ÷ʱÓбØÒª´¦ÀíÒ»ÏÂ
%%%%%%%%%%%%%%%%%%%%%%% 16_APSKÐźŴ¦ÀíÄ£¿é %%%%%%%%%%%%%%%%%%%%%%
%¸ø³öÐźÅÔ´
r1=R*alpha/3;
r2=R*alpha;
s0=[r1*exp(v*(2*pi*1/4-pi/4));
r1*exp(v*(2*pi*2/4-pi/4));
r1*exp(v*(2*pi*3/4-pi/4));
r1*exp(v*(2*pi*4/4-pi/4));
r2*exp(v*(2*pi*1/12-pi/12));
r2*exp(v*(2*pi*2/12-pi/12));
r2*exp(v*(2*pi*3/12-pi/12));
r2*exp(v*(2*pi*4/12-pi/12));
r2*exp(v*(2*pi*5/12-pi/12));
r2*exp(v*(2*pi*6/12-pi/12));
r2*exp(v*(2*pi*7/12-pi/12));
r2*exp(v*(2*pi*8/12-pi/12));
r2*exp(v*(2*pi*9/12-pi/12));
r2*exp(v*(2*pi*10/12-pi/12));
r2*exp(v*(2*pi*11/12-pi/12));
r2*exp(v*(2*pi*12/12-pi/12))];
s=s0.';
x=randint(1,N,M)+1;
for n=1:N
x_apk(n)=s(x(n));
end
figure(1);
plot(real(x_apk),imag(x_apk),'.');title('16APKÐźÅÐÇ×ùͼ');grid;
for i=1:30
%¼ÓÈëÔëÉù
x_apknoisy=awgn(x_apk,i,'measured');
r_apk=abs(x_apknoisy);
q_apk=angle(x_apknoisy);

for n=1:N
if r_apk(n)=(r1+r2)/2
if q_apk(n)=pi/2&q_apk(n)>0
x_deapk(n)=s(1);
elseif q_apk(n)=pi&q_apk(n)>pi/2
x_deapk(n)=s(2);
elseif q_apk(n)=-pi/2&q_apk(n)>-pi
x_deapk(n)=s(3);
else x_deapk(n)=s(4);
end
else if q_apk(n)=pi/6&q_apk(n)>0
x_deapk(n)=s(5);
elseif q_apk(n)=pi/3&q_apk(n)>pi/6
x_deapk(n)=s(6);
elseif q_apk(n)=pi/2&q_apk(n)>pi/3
x_deapk(n)=s(7);
elseif q_apk(n)=2*pi/3&q_apk(n)>pi/2
x_deapk(n)=s(8);
elseif q_apk(n)=5*pi/6&q_apk(n)>2*pi/3
x_deapk(n)=s(9);
elseif q_apk(n)=6*pi/6&q_apk(n)>5*pi/6
x_deapk(n)=s(10);
elseif q_apk(n)=-5*pi/6&q_apk(n)>-pi
x_deapk(n)=s(11);
elseif q_apk(n)=-2*pi/3&q_apk(n)>-5*pi/6
x_deapk(n)=s(12);
elseif q_apk(n)=-pi/2&q_apk(n)>-2*pi/3
x_deapk(n)=s(13);
elseif q_apk(n)=-pi/3&q_apk(n)>-pi/2
x_deapk(n)=s(14);
elseif q_apk(n)=-pi/6&q_apk(n)>-pi/3
x_deapk(n)=s(15);
else x_deapk(n)=s(16);
end
end
end
[num,rt]=symerr(x_apk,x_deapk);
ber_apk(i)=rt;
% figure(2);
% plot(real(x_apknoisy),imag(x_apknoisy),'.');
%¾­¹ý·Å´óÆ÷
for n=1:N
x_apk_hpa(n)=saleh(x_apknoisy(n))/ratio;
end
% figure(3);
% plot(real(x_apk_hpa),imag(x_apk_hpa),'.');

%½âµ÷¹ý³Ì
r_apk=abs(x_apk_hpa);
q_apk=angle(x_apk_hpa);
for n=1:N
if r_apk(n)<(r1+r2)/2
if q_apk(n)=pi/2&q_apk(n)>0
x_deapk(n)=s(1);
elseif q_apk(n)=pi&q_apk(n)>pi/2
x_deapk(n)=s(2);
elseif q_apk(n)=-pi/2&q_apk(n)>-pi
x_deapk(n)=s(3);
else x_deapk(n)=s(4);
end
else if q_apk(n)=pi/6&q_apk(n)>0
x_deapk(n)=s(5);
elseif q_apk(n)=pi/3&q_apk(n)>pi/6
x_deapk(n)=s(6);
elseif q_apk(n)=pi/2&q_apk(n)>pi/3
x_deapk(n)=s(7);
elseif q_apk(n)=2*pi/3&q_apk(n)>pi/2
x_deapk(n)=s(8);
elseif q_apk(n)=5*pi/6&q_apk(n)>2*pi/3
x_deapk(n)=s(9);
elseif q_apk(n)=6*pi/6&q_apk(n)>5*pi/6
x_deapk(n)=s(10);
elseif q_apk(n)=-5*pi/6&q_apk(n)>-pi
x_deapk(n)=s(11);
elseif q_apk(n)=-2*pi/3&q_apk(n)>-5*pi/6
x_deapk(n)=s(12);
elseif q_apk(n)=-pi/2&q_apk(n)>-2*pi/3
x_deapk(n)=s(13);
elseif q_apk(n)=-pi/3&q_apk(n)>-pi/2
x_deapk(n)=s(14);
elseif q_apk(n)=-pi/6&q_apk(n)>-pi/3
x_deapk(n)=s(15);
else x_deapk(n)=s(16);
end
end
end
[num,rt]=symerr(x_apk,x_deapk);
ber_apkhpa(i)=rt;

%%%%%%%%% ¼ÓÈëԤʧÕæ
A=[zeros(2,N);ones(1,N);zeros(5,N)];
T=[0.2,0,0,0,0,0,0,0;
0,0.2,0,0,0,0,0,0;
0,0,0.2,0,0,0,0,0;
0,0,0,0.2,0,0,0,0;
0,0,0,0,0.2,0,0,0;
0,0,0,0,0,0.2,0,0;
0,0,0,0,0,0,0.2,0;
0,0,0,0,0,0,0,0.2];
l1=0.6;l2=1;
w=x_apknoisy;
y=x_apknoisy;
y1=x_apknoisy;
z=x_apknoisy;
for n=3:N
Q(n,:)=[-y(n-1),-y(n-2),w(n),abs(w(n))^2*w(n),abs(w(n))^4*w(n),abs(w(n))^6*w(n),abs(w(n))^8*w(n),abs(w(n))^10*w(n)];
y(n)=Q(n,:)*A(:,n-1);
z(n)=saleh(y(n));
Q1(n,:)=[-y1(n-1),-y1(n-2),z(n),abs(z(n))^2*z(n),abs(z(n))^4*z(n),abs(z(n))^6*z(n),abs(z(n))^8*z(n),abs(z(n))^10*z(n)];
y1(n)=Q1(n,:)*A(:,n-1);
e(n)=(y(n)-y1(n))/(1+Q1(n,:)*T*Q1(n,:)');
A(:,n)=A(:,n-1)+T*Q1(n,:)'*e(n);
T=1/l1*(T-l2*T*Q1(n,:)'*Q1(n,:)*T/(l1+l2*Q1(n,:)*T*Q1(n,:)'));
end

r_apk=abs(z);
q_apk=angle(z);
for n=1:N
if r_apk(n)=(r1+r2)/2
if q_apk(n)=pi/2&q_apk(n)>0
x_deapk(n)=s(1);
elseif q_apk(n)=pi&q_apk(n)>pi/2
x_deapk(n)=s(2);
elseif q_apk(n)=-pi/2&q_apk(n)>-pi
x_deapk(n)=s(3);
else x_deapk(n)=s(4);
end
else if q_apk(n)=pi/6&q_apk(n)>0
x_deapk(n)=s(5);
elseif q_apk(n)=pi/3&q_apk(n)>pi/6
x_deapk(n)=s(6);
elseif q_apk(n)=pi/2&q_apk(n)>pi/3
x_deapk(n)=s(7);
elseif q_apk(n)=2*pi/3&q_apk(n)>pi/2
x_deapk(n)=s(8);
elseif q_apk(n)=5*pi/6&q_apk(n)>2*pi/3
x_deapk(n)=s(9);
elseif q_apk(n)=6*pi/6&q_apk(n)>5*pi/6
x_deapk(n)=s(10);
elseif q_apk(n)=-5*pi/6&q_apk(n)>-pi
x_deapk(n)=s(11);
elseif q_apk(n)=-2*pi/3&q_apk(n)>-5*pi/6
x_deapk(n)=s(12);
elseif q_apk(n)=-pi/2&q_apk(n)>-2*pi/3
x_deapk(n)=s(13);
elseif q_apk(n)=-pi/3&q_apk(n)>-pi/2
x_deapk(n)=s(14);
elseif q_apk(n)=-pi/6&q_apk(n)>-pi/3
x_deapk(n)=s(15);
else x_deapk(n)=s(16);
end
end
end
[num,rt]=symerr(x_apk(50:N),x_deapk(50:N));
ber_apkhpapd(i)=rt;
end
n=1:30;
figure(2);
semilogy(n,ber_apk,'-bd',n,ber_apkhpa,'-rd',n,ber_apkhpapd,'-g*');
legend('ÀíÏë×´¿ö','only HPA','HPA+Predistortion',3);
title('APSKÐÅÔë±ÈÓëÎóÂëÂʵĹØϵÇúÏß');
grid;
%%%%%%%%%%%%%%%%%%%%%%% 16_PSKÐźŴ¦ÀíÄ£¿é %%%%%%%%%%%%%%%%%%%%%%

s_psk=[R*exp(v*2*pi*1/16);
R*exp(v*2*pi*2/16);
R*exp(v*2*pi*3/16);
R*exp(v*2*pi*4/16);
R*exp(v*2*pi*5/16);
R*exp(v*2*pi*6/16);
R*exp(v*2*pi*7/16);
R*exp(v*2*pi*8/16);
R*exp(v*2*pi*9/16);
R*exp(v*2*pi*10/16);
R*exp(v*2*pi*11/16);
R*exp(v*2*pi*12/16);
R*exp(v*2*pi*13/16);
R*exp(v*2*pi*14/16);
R*exp(v*2*pi*15/16);
R*exp(v*2*pi*16/16)].';
for n=1:N
x_psk(n)=s_psk(x(n));
end
figure(3);
plot(real(x_psk),imag(x_psk),'.');title('16PSKÐźÅÐÇ×ùͼ');grid;
for i=1:30
x_psknoisy=awgn(x_psk,i,'measured');
r_psk=abs(x_psknoisy);
q_psk=angle(x_psknoisy);
for n=1:N
if q_psk(n)=3*pi/16&q_psk(n)>1*pi/16
x_depsk(n)=s_psk(1);
elseif q_psk(n)=5*pi/16&q_psk(n)>3*pi/16
x_depsk(n)=s_psk(2);
elseif q_psk(n)=7*pi/16&q_psk(n)>5*pi/16
x_depsk(n)=s_psk(3);
elseif q_psk(n)=9*pi/16&q_psk(n)>7*pi/16
x_depsk(n)=s_psk(4);
elseif q_psk(n)=11*pi/16&q_psk(n)>9*pi/16
x_depsk(n)=s_psk(5);
elseif q_psk(n)=13*pi/16&q_psk(n)>11*pi/16
x_depsk(n)=s_psk(6);
elseif q_psk(n)=15*pi/16&q_psk(n)>13*pi/16
x_depsk(n)=s_psk(7);
elseif q_psk(n)=16*pi/16&q_psk(n)>15*pi/16
x_depsk(n)=s_psk(8);
elseif q_psk(n)=-15*pi/16&q_psk(n)>-16*pi/16
x_depsk(n)=s_psk(8);
elseif q_psk(n)=-13*pi/16&q_psk(n)>-15*pi/16
x_depsk(n)=s_psk(9);
elseif q_psk(n)=-11*pi/16&q_psk(n)>-13*pi/16
x_depsk(n)=s_psk(10);
elseif q_psk(n)=-9*pi/16&q_psk(n)>-11*pi/16
x_depsk(n)=s_psk(11);
elseif q_psk(n)=-7*pi/16&q_psk(n)>-9*pi/16
x_depsk(n)=s_psk(12);
elseif q_psk(n)=-5*pi/16&q_psk(n)>-7*pi/16
x_depsk(n)=s_psk(13);
elseif q_psk(n)=-3*pi/16&q_psk(n)>-5*pi/16
x_depsk(n)=s_psk(14);
elseif q_psk(n)=-1*pi/16&q_psk(n)>-3*pi/16
x_depsk(n)=s_psk(15);
else
x_depsk(n)=s_psk(16);
end
end
[num,rt]=symerr(x_psk,x_depsk);
ber_psk(i)=rt;
% ͨ¹ý·Å´óÆ÷
for n=1:N
x_psk_hpa(n)=saleh(x_psknoisy(n))/ratio;
end
q_psk=angle(x_psk_hpa);
for n=1:N
if q_psk(n)=3*pi/16&q_psk(n)>1*pi/16
x_depsk(n)=s_psk(1);
elseif q_psk(n)=5*pi/16&q_psk(n)>3*pi/16
x_depsk(n)=s_psk(2);
elseif q_psk(n)=7*pi/16&q_psk(n)>5*pi/16
x_depsk(n)=s_psk(3);
elseif q_psk(n)=9*pi/16&q_psk(n)>7*pi/16
x_depsk(n)=s_psk(4);
elseif q_psk(n)=11*pi/16&q_psk(n)>9*pi/16
x_depsk(n)=s_psk(5);
elseif q_psk(n)=13*pi/16&q_psk(n)>11*pi/16
x_depsk(n)=s_psk(6);
elseif q_psk(n)=15*pi/16&q_psk(n)>13*pi/16
x_depsk(n)=s_psk(7);
elseif q_psk(n)=16*pi/16&q_psk(n)>15*pi/16
x_depsk(n)=s_psk(8);
elseif q_psk(n)=-15*pi/16&q_psk(n)>-16*pi/16
x_depsk(n)=s_psk(8);
elseif q_psk(n)=-13*pi/16&q_psk(n)>-15*pi/16
x_depsk(n)=s_psk(9);
elseif q_psk(n)=-11*pi/16&q_psk(n)>-13*pi/16
x_depsk(n)=s_psk(10);
elseif q_psk(n)=-9*pi/16&q_psk(n)>-11*pi/16
x_depsk(n)=s_psk(11);
elseif q_psk(n)=-7*pi/16&q_psk(n)>-9*pi/16
x_depsk(n)=s_psk(12);
elseif q_psk(n)=-5*pi/16&q_psk(n)>-7*pi/16
x_depsk(n)=s_psk(13);
elseif q_psk(n)=-3*pi/16&q_psk(n)>-5*pi/16
x_depsk(n)=s_psk(14);
elseif q_psk(n)=-1*pi/16&q_psk(n)>-3*pi/16
x_depsk(n)=s_psk(15);
else
x_depsk(n)=s_psk(16);
end
end
[num,rt]=symerr(x_psk,x_depsk);
ber_pskhpa(i)=rt;
%¼ÓÈëԤʧÕæ
A=[zeros(2,N);ones(1,N);zeros(5,N)];
T=[0.2,0,0,0,0,0,0,0;
0,0.2,0,0,0,0,0,0;
0,0,0.2,0,0,0,0,0;
0,0,0,0.2,0,0,0,0;
0,0,0,0,0.2,0,0,0;
0,0,0,0,0,0.2,0,0;
0,0,0,0,0,0,0.2,0;
0,0,0,0,0,0,0,0.2];
l1=0.6;l2=1;
w=x_psknoisy;
y=x_psknoisy;
y1=x_psknoisy;
z=x_psknoisy;
for n=3:N
Q(n,:)=[-y(n-1),-y(n-2),w(n),abs(w(n))^2*w(n),abs(w(n))^4*w(n),abs(w(n))^6*w(n),abs(w(n))^8*w(n),abs(w(n))^10*w(n)];
y(n)=Q(n,:)*A(:,n-1);
z(n)=saleh(y(n));
Q1(n,:)=[-y1(n-1),-y1(n-2),z(n),abs(z(n))^2*z(n),abs(z(n))^4*z(n),abs(z(n))^6*z(n),abs(z(n))^8*z(n),abs(z(n))^10*z(n)];
y1(n)=Q1(n,:)*A(:,n-1);
e(n)=(y(n)-y1(n))/(1+Q1(n,:)*T*Q1(n,:)');
A(:,n)=A(:,n-1)+T*Q1(n,:)'*e(n);
T=1/l1*(T-l2*T*Q1(n,:)'*Q1(n,:)*T/(l1+l2*Q1(n,:)*T*Q1(n,:)'));
end
q_psk=angle(z);
for n=1:N
if q_psk(n)=3*pi/16&q_psk(n)>1*pi/16
x_depsk(n)=s_psk(1);
elseif q_psk(n)=5*pi/16&q_psk(n)>3*pi/16
x_depsk(n)=s_psk(2);
elseif q_psk(n)=7*pi/16&q_psk(n)>5*pi/16
x_depsk(n)=s_psk(3);
elseif q_psk(n)=9*pi/16&q_psk(n)>7*pi/16
x_depsk(n)=s_psk(4);
elseif q_psk(n)=11*pi/16&q_psk(n)>9*pi/16
x_depsk(n)=s_psk(5);
elseif q_psk(n)=13*pi/16&q_psk(n)>11*pi/16
x_depsk(n)=s_psk(6);
elseif q_psk(n)=15*pi/16&q_psk(n)>13*pi/16
x_depsk(n)=s_psk(7);
elseif q_psk(n)=16*pi/16&q_psk(n)>15*pi/16
x_depsk(n)=s_psk(8);
elseif q_psk(n)=-15*pi/16&q_psk(n)>-16*pi/16
x_depsk(n)=s_psk(8);
elseif q_psk(n)=-13*pi/16&q_psk(n)>-15*pi/16
x_depsk(n)=s_psk(9);
elseif q_psk(n)=-11*pi/16&q_psk(n)>-13*pi/16
x_depsk(n)=s_psk(10);
elseif q_psk(n)=-9*pi/16&q_psk(n)>-11*pi/16
x_depsk(n)=s_psk(11);
elseif q_psk(n)=-7*pi/16&q_psk(n)>-9*pi/16
x_depsk(n)=s_psk(12);
elseif q_psk(n)=-5*pi/16&q_psk(n)>-7*pi/16
x_depsk(n)=s_psk(13);
elseif q_psk(n)=-3*pi/16&q_psk(n)>-5*pi/16
x_depsk(n)=s_psk(14);
elseif q_psk(n)=-1*pi/16&q_psk(n)>-3*pi/16
x_depsk(n)=s_psk(15);
else
x_depsk(n)=s_psk(16);
end
end
[num,rt]=symerr(x_psk(50:N),x_depsk(50:N));
ber_pskhpapd(i)=rt;
end
n=1:30;
figure(4);
semilogy(n,ber_psk,'-bd',n,ber_pskhpa,'-rd',n,ber_pskhpapd,'-g*');
legend('ÀíÏë×´¿ö','only HPA','HPA+Predisyortion',3);
title('PSKÐÅÔë±ÈÓëÎóÂëÂʵĹØϵÇúÏß');
grid;
%%%%%%%%%%%%%%%%%%%%% 16qamÐźŴ¦ÀíÄ£¿é %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x1=(fix(4*rand(1,N))*2-3)/3*R*beta;
x2=(fix(4*rand(1,N))*2-3)/3*R*beta;
x_qam=x1+v*x2;
d=R*beta*2/3;
figure(5);
plot(real(x_qam),imag(x_qam),'.');title('16QAMÐźÅÐÇ×ùͼ');grid;
for i=1:30

x_qamnoisy=awgn(x_qam,i,'measured'); % ¼ÓÈëÔëÉù
xi=real(x_qamnoisy);
xq=imag(x_qamnoisy);
for n=1:N
if xi(n)=d&xi(n)>0
if xq(n)=d&xq(n)>0
x_deqam(n)=d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=d/2-v*d/2;
else x_deqam(n)=d/2-v*d*3/2;
end
elseif xi(n)>d
if xq(n)=d&xq(n)>0
x_deqam(n)=3*d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=3*d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=3*d/2-v*d/2;
else x_deqam(n)=3*d/2-v*d*3/2;
end
elseif xi(n)=0&xi(n)>-d
if xq(n)=d&xq(n)>0
x_deqam(n)=-d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=-d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=-d/2-v*d/2;
else x_deqam(n)=-d/2-v*d*3/2;
end
else
if xq(n)=d&xq(n)>0
x_deqam(n)=-3*d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=-3*d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=-3*d/2-v*d/2;
else x_deqam(n)=-3*d/2-v*d*3/2;
end
end
end
[num,rt]=symerr(x_qam,x_deqam);
ber_qam(i)=rt;

%%%%%%%%%%% ͨ¹ý·Å´óÆ÷
for n=1:N
x_qamhpa(n)=saleh(x_qamnoisy(n))/ratio;
end
xi=real(x_qamhpa);
xq=imag(x_qamhpa);
for n=1:N
if xi(n)=d&xi(n)>0
if xq(n)=d&xq(n)>0
x_deqam(n)=d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=d/2-v*d/2;
else x_deqam(n)=d/2-v*d*3/2;
end
elseif xi(n)>d
if xq(n)=d&xq(n)>0
x_deqam(n)=3*d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=3*d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=3*d/2-v*d/2;
else x_deqam(n)=3*d/2-v*d*3/2;
end
elseif xi(n)=0&xi(n)>-d
if xq(n)=d&xq(n)>0
x_deqam(n)=-d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=-d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=-d/2-v*d/2;
else x_deqam(n)=-d/2-v*d*3/2;
end
else
if xq(n)=d&xq(n)>0
x_deqam(n)=-3*d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=-3*d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=-3*d/2-v*d/2;
else x_deqam(n)=-3*d/2-v*d*3/2;
end
end
end
[num,rt]=symerr(x_qam,x_deqam);
ber_qamhpa(i)=rt;
%%%%%%%% ͨ¹ýԤʧÕæÆ÷
A=[zeros(2,N);ones(1,N);zeros(5,N)];
T=[0.2,0,0,0,0,0,0,0;
0,0.2,0,0,0,0,0,0;
0,0,0.2,0,0,0,0,0;
0,0,0,0.2,0,0,0,0;
0,0,0,0,0.2,0,0,0;
0,0,0,0,0,0.2,0,0;
0,0,0,0,0,0,0.2,0;
0,0,0,0,0,0,0,0.2];
l1=0.6;l2=1;
w=x_qamnoisy;
y=x_qamnoisy;
y1=x_qamnoisy;
z=x_qamnoisy;
for n=3:N
Q(n,:)=[-y(n-1),-y(n-2),w(n),abs(w(n))^2*w(n),abs(w(n))^4*w(n),abs(w(n))^6*w(n),abs(w(n))^8*w(n),abs(w(n))^10*w(n)];
y(n)=Q(n,:)*A(:,n-1);
z(n)=saleh(y(n));
Q1(n,:)=[-y1(n-1),-y1(n-2),z(n),abs(z(n))^2*z(n),abs(z(n))^4*z(n),abs(z(n))^6*z(n),abs(z(n))^8*z(n),abs(z(n))^10*z(n)];
y1(n)=Q1(n,:)*A(:,n-1);
e(n)=(y(n)-y1(n))/(1+Q1(n,:)*T*Q1(n,:)');
A(:,n)=A(:,n-1)+T*Q1(n,:)'*e(n);
T=1/l1*(T-l2*T*Q1(n,:)'*Q1(n,:)*T/(l1+l2*Q1(n,:)*T*Q1(n,:)'));
end
xi=real(z);
xq=imag(z);
for n=1:N
if xi(n)=d&xi(n)>0
if xq(n)=d&xq(n)>0
x_deqam(n)=d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=d/2-v*d/2;
else x_deqam(n)=d/2-v*d*3/2;
end
elseif xi(n)>d
if xq(n)=d&xq(n)>0
x_deqam(n)=3*d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=3*d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=3*d/2-v*d/2;
else x_deqam(n)=3*d/2-v*d*3/2;
end
elseif xi(n)=0&xi(n)>-d
if xq(n)=d&xq(n)>0
x_deqam(n)=-d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=-d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=-d/2-v*d/2;
else x_deqam(n)=-d/2-v*d*3/2;
end
else
if xq(n)=d&xq(n)>0
x_deqam(n)=-3*d/2+v*d/2;
elseif xq(n)>d
x_deqam(n)=-3*d/2+v*d*3/2;
elseif xq(n)>-d&xq(n)=0
x_deqam(n)=-3*d/2-v*d/2;
else x_deqam(n)=-3*d/2-v*d*3/2;
end
end
end
[num,rt]=symerr(x_qam(30:N),x_deqam(30:N));
ber_qamhpapd(i)=rt;
end
n=1:30;
figure(6);
semilogy(n,ber_qam,'-bd',n,ber_qamhpa,'-rd',n,ber_qamhpapd,'-g*');
legend('ÀíÏë×´¿ö','only HPA','HPA+Predisyortion',3);
title('QAMÐÅÔë±ÈÓëÎóÂëÂʵĹØϵÇúÏß');
grid;
n=1:30;
figure(7);
semilogy(n,ber_apkhpa,'-bd',n,ber_pskhpa,'-ro',n,ber_qamhpa,'-g*');
legend('16APKÐźÅ','16PSKÐźÅ','16QAMÐźÅ',3);
title('ÐÅÔë±ÈÓëÎóÂëÂʹØϵÇúÏß(·Å´óÆ÷¶ÔÐźÅÓ°Ïì)');
xlabel('SNR(dB)');
ylabel('ÎóÂëÂÊ');
grid;
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7667
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Oct 24, 2011 6:39 pm    Post subject: Reply with quote

Moved from Portage & Programming to Duplicate Threads in favor of apsk matlab code.

- John
_________________
This space intentionally left blank.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Duplicate Threads All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum