永发信息网

Matlab实现 psk Dqpsk Qpsk 仿真程序

答案:1  悬赏:40  手机版
解决时间 2021-04-04 02:27
  • 提问者网友:轮囘Li巡影
  • 2021-04-03 04:53
Matlab实现 psk Dqpsk Qpsk 仿真程序
最佳答案
  • 五星知识达人网友:行路难
  • 2021-04-03 05:32
% file c10_MCQPSKrun.m
%

%
function BER_MC=c10_MCQPSKrun(N,Eb,No,ChanAtt,...

TimingBias,TimingJitter,PhaseBias,PhaseJitter)
fs = 1e+6;

% sampling Rate (samples/second)
SymRate = 1e+5;

% symbol rate (symbols/second)
Ts = 1/fs;

% sampling period
TSym = 1/SymRate;

% symbol period
SymToSend = 100;%N;

% symbols to be transmitted
ChanBW = 4.99e+5;

% bandwidth of channel (Hz)
MeanCarrierPhaseError = PhaseBias;

% mean of carrier phase

StdCarrierPhaseError = PhaseJitter;

% stdev of phese error

MeanSymbolSyncError = TimingBias;

% mean of symbol sync error
StdSymbolSyncError = TimingJitter;

% stdev of symbol sync error
ChanGain = 10^(-ChanAtt/20);

% channel gain (linear units)
TxBitClock = Ts/2;

% transmitter bit clock
RxBitClock = Ts/2;

% reciever bit clock
%
%

Standard deviation of noise and signal amplitude at receiver input.
%
RxNoiseStd = sqrt((10^((No-30)/10))*(fs/2));

% stdev of noise
TxSigAmp = sqrt(10^((Eb-30)/10)*SymRate);

% signal amplitude
%
% Allocate some memory for probes.
%
SampPerSym = fs/SymRate;
probe1 = zeros((SymToSend+1)*SampPerSym,1);
probe1counter = 1;
probe2 = zeros((SymToSend+1)*SampPerSym,1);
probe2counter = 1;
%
% Counters to keep track of how many symbols have have been sent.
%

TxSymSent = 1;
RxSymDemod = 0;
%
% Buffers that contain the transmitted and received data.
%
[unused,SourceBitsI] = random_binary(SymToSend,1);
[unused,SourceBitsQ] = random_binary(SymToSend,1);
%
% Differentially encode the transmitted data.
%

TxBitsI = SourceBitsI*0;
TxBitsQ = SourceBitsQ*0;
for k=2:length(TxBitsI)

TxBitsI(k) = or(and(not(xor(SourceBitsI(k),SourceBitsQ(k))),...

xor(SourceBitsI(k),TxBitsI(k-1))), ...

and(xor(SourceBitsI(k),SourceBitsQ(k)),...

xor(SourceBitsQ(k),TxBitsQ(k-1))));

TxBitsQ(k) = or(and(not(xor(SourceBitsI(k),SourceBitsQ(k))),...

xor(SourceBitsQ(k),TxBitsQ(k-1))), ...

and(xor(SourceBitsI(k),SourceBitsQ(k)),...

xor(SourceBitsI(k),TxBitsI(k-1))));
end
%
% Make a complex data stream of the I and Q bits.
%
TxBits = ((TxBitsI*2)-1)+(sqrt(-1)*((TxBitsQ*2)-1));
%
RxIntegrator = 0;

% initialize receiver integrator
TxBitClock = 2*TSym;

% initialize transmitter
%
% Design the channel filter, and create the filter state array.
%
[b,a] = butter(2,ChanBW/(fs/2));
b=[1]; a=[1];

% filter bypassed

[junk,FilterState]=filter(b,a,0);
%
% Begin simulation loop.
%
while TxSymSent < SymToSend

%

% Update the transmitter's clock, and see

% if it is time to get new data bits

%

TxBitClock=TxBitClock+Ts;

if TxBitClock > TSym

%

% Time to get new bits

%

TxSymSent=TxSymSent+1;

%

% We don't want the clock to increase off

% to infinity, so subtract off an integer number

% of Tb seconds

%
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯