⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smedge2.asv

📁 我们现在GSM/EDGE信号采用的是旋转的8PSK调制方式
💻 ASV
字号:

E = 1;
snr_in_dB=15;%%%%%%%%%%%%%%%%%      we can change snr_in_dB' value here
SNR = exp(snr_in_dB*log(10)/10);   %singal to noise ratio
sgma = E/sqrt(2*SNR);              %sigma,standard deviation of noise
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%           smedge finds the probability of error for the given
%           snr_in_dB,signal to noise ration in dB.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a2=[0 pi/4 pi/2 3*pi/4 pi -pi/4 -pi/2 -3*pi/4];
a4=[0 0 0;0 0 1;0 1 1;0 1 0;1 1 0;1 0 0;1 0 1;1 1 1];

b2=exp(j*a2);
M=8;
N=1000;%符号              
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

input=round(rand(1,log2(M)*N)); 

theta(1)=0; %初始相位
R1=2;
for i=1:3:length(input)-2
    if ((input(i)==1)&(input(i+1)==1)&(input(i+2)==1))
        del_theta=-3*pi/4;
    elseif ((input(i)==0)&(input(i+1)==1)&(input(i+2)==1))
        del_theta=pi/2;
          elseif ((input(i)==0)&(input(i+1)==1)&(input(i+2)==0))
        del_theta=3*pi/4;
          elseif ((input(i)==0)&(input(i+1)==0)&(input(i+2)==0))
        del_theta=0;
          elseif ((input(i)==1)&(input(i+1)==1)&(input(i+2)==0))
        del_theta=pi;
          elseif ((input(i)==1)&(input(i+1)==0)&(input(i+2)==0))
        del_theta=-pi/4;
          elseif ((input(i)==1)&(input(i+1)==0)&(input(i+2)==1))
        del_theta=-pi/2;
          elseif ((input(i)==0)&(input(i+1)==0)&(input(i+2)==1))
         del_theta=pi/4;
     end 
     theta(R1)=del_theta+R1*3*pi/8;
     R1=R1+1;
 end
 x1=exp(j*theta);
 et=x1(1:N);
 
 figure(1);
 plot(et);
 title('e(t):rotate 3/8pi');
 
 %insert zeros
for i=1:length(et)
 etx(2*i-1)=real(et(i));
 ety(2*i-1)=imag(et(i));
end

for i=1:length(et);
  etx(2*i)=0;
  ety(2*i)=0;
end

et_insert_zeros=etx+j*ety;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%et_insert_zeros_add_noise=etx_noise+j*ety_noise;%add noise
et_insert_zeros_add_noise=et_insert_zeros+gngauss2(sgma);
%%%%%%%%%

%%%gsm/edge pulse shaping
tx=[-0 0.0007 0.0315 0.2604 0.7057 0.9268 0.7057 0.2605 0.0315 0.0008 0];
shaped_et=filter(tx,1,[et_insert_zeros_add_noise]);
figure(2);
plot(shaped_et);
title('pulse shape');
%%%%%%

%%%%%%
c_opt=[0         0   -0.0031    0.1384   -1.1360    2.7314   -1.1360    0.1384   -0.0031         0         0];%coefficient of RX
equalized_st=filter(c_opt,1,[shaped_et]);%zero forcing filter   
equalized_st=equalized_st(3:length(equalized_st));%adjust the delay
figure(4);
plot(equalized_st);
title('equalized-st');
%%%%%
for i=1:2:length(equalized_st)
   downsampled_equalizer_output((i+1)/2)=equalized_st(i);%underdown sampling
end
downsampled_equalizer_output=downsampled_equalizer_output(5:length(downsampled_equalizer_output));
figure(5);
plot(downsampled_equalizer_output);
title('after receiver with no ISI');
%%%%%%%%%%%jugde 
  x=real(downsampled_equalizer_output);
  y=imag(downsampled_equalizer_output);
for i=2:length(downsampled_equalizer_output)-1;
    theta2(i)=qxw(x(i),y(i));
    theta3(i)=theta2(i)-i*3*pi/8;
    i=i+1;
end
x2=exp(j*theta3);
figure(6);
plot(x2,'.');
title('normal 8psk');
epsk_out=[];

x_judge=real(x2);
y_judge=imag(x2);
for i=2:length(x2)-1
      phase1(i)=qxw(x_judge(i),y_judge(i));
      %%%%%%
     if( (phase1(i)-(-3.1414))<=0.42 )
          phase1(i)=3.1414;
     end
      
      %%%%%%
      s=abs(phase1(i)-a2(1)); 
    m=1;
       for k=2:8
        if s>abs((phase1(i)-a2(k)))
          m=k;
          s=abs((phase1(i)-a2(k)));
      end
     end
   epsk_out=[epsk_out a4(m,:)];     
end
%%probility:
ps=0;
for n=1:length(epsk_out)
    if( input(n)==epsk_out(n))
        continue;
        else
            n
      ps=ps+1;
  end
end
p=ps/(3*N)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -