运行结果应该是一个矩阵和一个误码率BER(n),但实际运行完只剩矩阵,帮忙看程序那出现问题了
程序有好几个上传不方便,希望有好心人能帮我,下周就答辩了。QQ317885381
Email:
[email protected]silas_xue
2009-05-21, 02:50
lz 能否把你的问题在说的仔细些
大家一同讨论一下
%
% 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
这个程序如果把*********以下的程序删了,运行结果没有改变
vBulletin® v3.8.3,版权所有 ©2000-2025,Jelsoft Enterprises Ltd.