Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
回复
 
主题工具 显示模式
旧 2009-05-20, 23:15   #1
srfxz
初级会员
 
注册日期: 2009-05-20
帖子: 2
声望力: 0
srfxz 正向着好的方向发展
呲牙 程序运行结果有点问题,请求帮忙

运行结果应该是一个矩阵和一个误码率BER(n),但实际运行完只剩矩阵,帮忙看程序那出现问题了
程序有好几个上传不方便,希望有好心人能帮我,下周就答辩了。QQ317885381
Email:[email protected]
srfxz 当前离线   回复时引用此帖
旧 2009-05-21, 02:50   #2
silas_xue
高级会员
 
注册日期: 2008-11-01
年龄: 39
帖子: 406
声望力: 26
silas_xue 是一个将要出名的人
默认 回复: 程序运行结果有点问题,请求帮忙

lz 能否把你的问题在说的仔细些
大家一同讨论一下
silas_xue 当前离线   回复时引用此帖
旧 2009-05-21, 20:29   #3
srfxz
初级会员
 
注册日期: 2009-05-20
帖子: 2
声望力: 0
srfxz 正向着好的方向发展
默认 回复: 程序运行结果有点问题,请求帮忙

%
% FUNCTION 8.5 : "cp0801_PPMreceiver"
%
% Simulates the receiver for 2PPM TH UWB signals
% and computes the average BER
% 'R' is an array containing different waveforms
% of the received signal.
% 'mask' is the waveform of the correlation mask
% 'fc' is the sampling frequency
% 'bits' is the binary stream generated by the source
% (it is the same stream for all the waveforms in 'R')
% 'Ns' is the number of pulses per bit
% 'Ts' is the average pulse repetition period [s]
%
% The function returns the binary stream after the
% detection process ('RXbits') and the vector 'BER'
% containing the average bit error rates for all
% the signals in the input array 'R'.
%
% Programmed by Guerino Giancola
%

function [RXbits,BER] = ...
cp0801_PPMreceiver(R,mask,fc,bits,numbit,Ns,Ts)

% -----------------------------
% Step Zero - Receiver settings
% -----------------------------
Ns=5;
[bits,THcode,Stx,ref]=cp0201_transmitter_2PPM_TH;
exno=[0 2 4 6 8];
input=Stx;
numpulses=2;
[output,noise] =cp0801_Gnoise2(input,exno,numpulses);
R=output;
fc=50e9;
dPPM=0.5e-9;
Ts=3e-9;
numbit=2;
[mask] = cp0801_PPMcorrmask(ref,fc,numpulses,dPPM);
HDSD = 1;
% HDSD = 1 --> Hard Decision Detection
% HDSD = 2 --> Soft Decision Detection

% -----------------------------------------
% Step One - Implementation of the receiver
% -----------------------------------------

% N is the number of different signals at the receiver
% input L is the number of samples representing each signal
[N,L] = size(R);

RXbits = zeros(N,numbit);
***************************************************************
dt = 1 / fc; % sampling time
framesamples = floor(Ts ./ dt); % number of samples per
% frame
bitsamples = framesamples * Ns; % number of samples per

for n = 1 : N

rx = R(n,;
mx = rx .* mask;

if HDSD == 1 % Hard Decision Detection

for nb = 1 : numbit

mxk = mx(1+(nb-1)*bitsamples:bitsamples+...
(nb-1)*bitsamples);
No0 = 0;
No1 = 0;

for np = 1 : Ns
mxkp = mxk(1+(np-1)*framesamples:...
framesamples+(np-1)*framesamples);
zp = sum(mxkp.*dt);
if zp > 0
No0 = No0 + 1;
else
No1 = No1 + 1;
end
end % for np = 1 : Ns

if No0 > No1
% the estimated bit is '0'
RXbits(n,nb) = 0;
else
% the estimated bit is '0'
RXbits(n,nb) = 1;
end

end % for nb = 1 : numbit

end % end of Hard Decision Detection

if HDSD == 2 % Soft Decision Detection

for nb = 1 : numbit

mxk = mx(1+(nb-1)*bitsamples:bitsamples+...
(nb-1)*bitsamples);
zb = sum(mxk.*dt);

if zb > 0
% the estimated bit is '0'
RXbits(n,nb) = 0;
else
% the estimated bit is '1'
RXbits(n,nb) = 1;
end

end % for nb = 1 : numbit

end % end of Soft Decision Detection

end % for n = 1 : N
% ---------------------
% Step Two - Statistics
% ---------------------
for n = 1 : N
WB = sum(abs(bits-RXbits(n,));
BER(n) = WB / numbit; % average Bit Error Rate
end % bit


这个程序如果把*********以下的程序删了,运行结果没有改变
srfxz 当前离线   回复时引用此帖
回复


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

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



所有时间均为北京时间。现在的时间是 10:37


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