資源簡(jiǎn)介
QPSK調(diào)制解調(diào)源代碼及仿真程序,可以根據(jù)此程序仿真QPSK的整個(gè)過(guò)程
代碼片段和文件信息
%%?Phase?Shift?Keying?Simulation
%?This?demo?shows?how?to?simulate?a?basic?Quarternary?Phase?Shift?Keying
%?(QPSK)?communication?link?and?to?generate?empirical?performance?curves
%?that?can?be?compared?to?theoretical?predictions.
%?Copyright?1996-2004?The?MathWorks?Inc.
%?$Revision:?1.12.2.5?$?$Date:?2004/04/12?23:01:29?$
%%?Initializing?variables
%?The?first?step?is?to?initialize?variables?for?number?of?samples?per
%?symbol?number?of?symbols?to?simulate?alphabet?size?(M)?and?the?signal
%?to?noise?ratio.?The?last?line?seeds?the?random?number?generators.
nSamp?=?8;?numSymb?=?100;???
M?=?4;?SNR?=?14;?
seed?=?[12345?54321];????????
rand(‘state‘?seed(1));?randn(‘state‘?seed(2));
%%?Generating?random?information?symbols
%?Next?use?RANDSRC?to?generate?random?information?symbols?from?0?to?M-1.
%?Since?the?simulation?is?of?QPSK?the?symbols?are?0?through?3.?The?first
%?10?data?points?are?plotted.
numPlot?=?10;
rand(‘state‘?seed(1));
msg_orig?=?randsrc(numSymb?1?0:M-1);
stem(0:numPlot-1?msg_orig(1:numPlot)?‘bx‘);
xlabel(‘Time‘);?ylabel(‘Amplitude‘);
%%?Phase?modulating?the?data?
%?Use?PSKMOD?to?phase?modulate?the?data?and?RECTPULSE?to?upsample?to?a
%?sampling?rate?8?times?the?carrier?frequency.?Use?SCATTERPLOT?to?see?the
%?signal?constellation.
grayencod?=?bitxor(0:M-1?floor((0:M-1)/2));?
msg_gr_orig?=?grayencod(msg_orig+1);
msg_tx?=?pskmod(msg_gr_origM);
msg_tx?=?rectpulse(msg_txnSamp);
h1?=?scatterplot(msg_tx);
set(h1‘position‘[93?680?420?420]);
%%?Creating?the?noisy?signal
%?Then?use?AWGN?to?add?noise?to?the?transmitted?signal?to?create?the?noisy
%?signal?at?the?receiver.?Use?the?‘measured‘?option?to?add?noise?that?is
%?14?dB?below?the?average?signal?power?(SNR?=?14?dB).?Plot?the
%?constellation?of?the?received?signal.
randn(‘state‘?seed(2));
msg_rx?=?awgn(msg_tx?SNR?‘measured‘?[]?‘dB‘);
h2?=?scatterplot(msg_rx);
%%?Recovering?information?from?the?transmitted?signal
%
評(píng)論
共有 條評(píng)論