Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
回复
 
主题工具 显示模式
旧 2009-11-20, 00:06   #1
ray58
初级会员
 
注册日期: 2009-05-24
帖子: 1
声望力: 0
ray58 正向着好的方向发展
默认 【急求助】QPSK system的模拟(新手上路啊)

帮忙看下我的code ,请求指导sampling,decision 和 BER,SER的具体写法
要求:
-data rate= 100kbps
-4time oversampling(base band)
- Matched filter
* Root raised cosine filter
-waterfall curve(Monte calro simulation)
* BER of Eb/N0
* SER of SNR
同时还给出了 一个 “time domain sequence" (后面用rrcf)来conv后形成 filter
我的思路:1.建bitstream (data)2. 进行mapping 分出(1,-1) 3. 并串转换分出Real & Imag 4. 分别对Real & Imag

进行oversampling(4个4个一组) 5. 分别 通过 Pulse shapping filter 6. 把Real & Imag 转换成a+jb形式在加上noise

7.在与rrcf进行conv 8. 再分别对Real & Imag各部分采样
9.进行decision操作,把bitstream换成(1,0)的形式 9. 进行串并转换形成demo数据流 10. 与原数据流进行比较画出

bit error rate (BER) & symbol error rate(SER) 的关系图如要求

clear all

%********************%
% Preparation Part %
%********************%
br=100000; %bit rate
%nd= ; %number of symbol
%Eb_No=5; %Eb/No
sr=50000 ;% symbol rate

%********************%
% Filter Part %
%********************%
% IPOINT=4; % number of oversample
%R=0.2; %roll off factor

%irfn=21; % number of filter taps
%[xh] = hrollfcoef(irfn,IPOINT,sr,alfs,1); %T FILTER FUNCTION
%[xh2] = hrollfcoef(irfn,IPOINT,sr,alfs,0); %R FILTER FUNCTION

%BW=(1/2)*sr*(1+R); % bandwidth

data=[1 0 1 0 1 1 1 0 0 0 1 1 0 1 1 0 0];
for k=1:length(data)
if data(k)==0;
data(k)=-1;
else data(k)=1;
end
end


%for i=0:12; % SNR
error=0;
for k=1:length(data)/2
Re(k)=data(2*k-1)/sqrt(2);
Im(k)=data(2*k)/sqrt(2);
end
Re_over=zeros(1,length(data)/2*4);
Im_over=zeros(1,length(data)/2*4);
for k=1:length(data)/2
Re_over(4*k-3)=Re(k);
Im_over(4*k-3)=Im(k);
end

%****************************%
% Time domain sequence %

%squence
rrcf=[-0.0189 0.0106 0.0424 0.0520 0.0233 -0.0360 -0.0924 -0.1000
0.0263 0.1261 0.3136 0.4677 0.5273 0.4677 0.3136 0.1261 -0.0263
-0.1000 -0.0924 -0.0360 0.0233 0.0520 0.0424 0.0106 -0.0189];

R_sq=conv(Re_over,rrcf);
I_sq=conv(Im_over,rrcf);
tx=R_sq+j*I_sq; %transimte signle

%****************************%
% AWGN %
Eb_No= [-3:10];
noise_gain=10^(-Eb_No/20)/sqrt(2);
n0=randn(1)+j*randn(1);
n=n0* noise_gain;

rx=tx+n; % receive signle

Re_rx=real(rx);
Im_rx=imag(rx);

%Root raised cosine filter
R_rx=conv(Re_rx,rrcf);
I_rx=conv(Im_rx,rrcf);




%filter=rcosfir(R,n_T,rate,T);
%****************************%
% Sampling %



%****************************%
% Decision %
R_rx_de= ;
I_rx_de= ;

%****************************%
% Multiplexer %
QPSK_r=(sqrt(1/2).*R_rx_de+sqrt(1/2).*I_rx_de);


%****************************%
% Compare %
for i=1:length(data)
if QPSK_r(i)~=data(i)
error=error+1
end
end
ber=error/100000;



%****************************%
% PLOT %
%****************************%

% oversampling
figure(1)
subplot(2,1,1),stem(Re_over,'fill','--'),grid
subplot(2,1,2),stem(Im_over,'fill','--'),grid

% pulse shaping filter
figure(2)
subplot(2,1,1),stem(R_sq,'--'),grid
subplot(2,1,2),stem(I_sq,'--'),grid

figure(3)
subplot(2,1,1),stem(R_rx,'--'),grid
subplot(2,1,2),stem(I_rx,'--'),grid

%BER OF Eb/N0
figure(4)
semilogy(Eb_N0_dB,ber,'b.-');
hold on
axis([-3 10 10^-5 0.5])
grid on
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');

% SER OF SNR
figure(5)
%axis([-1 11 -60 -5]);
title('QPSK');
xlabel('SNR(dB)');
ylabel('SER(dB)');
semilogy(snr,ser)
grid;


%end
拜托拜托了
ray58 当前离线   回复时引用此帖
回复

主题工具
显示模式

发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 22:27


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.