⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qam.m

📁 QAM调制仿真程序
💻 M
字号:
From: <由 Microsoft Internet Explorer 5 保存>
Subject: 
Date: Tue, 6 Jan 2009 19:55:22 +0800
MIME-Version: 1.0
Content-Type: text/html;
	charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.mathworks.com/matlabcentral/fx_files/21387/1/QAM_AWGN_Fading_new.m
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2900.5726" name=3DGENERATOR></HEAD>
<BODY><PRE>% first written by Saeed Akhavan-Astaneh
% revised by B. Jiang for new communication toolbox of matlab.
% 2008.09.10
% Simulation of QAM + AWGN + Rayleigh Fading
% clear all; clc; close all;

% Modulation schem M-QAM
M =3D 16;

% Received SNR
SNR =3D 1:2:20;

% Create Rayleigh fading channel object.
bitRate =3D 10000;
ch =3D rayleighchan(1/bitRate, 10, 0 ,0);=20
ch.ResetBeforeFiltering =3D 0;


% Transmitted Data ~ with Normal PDF
tx =3D randint(5000,1,M);
hmod=3Dqammod(tx,M);
gmod =3D qamdemod(hmod,M);=20
% Modulator and Demodulator Objects

% Rayleigh Fading Ampalitude without Phase Fading,=20
% The key point for ONES is that, in some modulation schemes like DPSK
% the phase error can not destroy the results.=20
% Remind that we have two error effects: Gain error and Phase error.=20
% employing qam or qpsk means your system is sensitive to phase error =
and a uniform phase error=20
% is equal to flipping a coin in your receiver side to decide for =
symbols=20
% so the error probability is obviously 1/n.=20
% In contrast, DPSK is robust in terms of phase error.
% I used the ONES + abs code to get rid of phase error and to find the =
impulse response of=20
% the system. I assumed that the time duration between consecutive =
transmitted=20
% symbols are large enough that there is no ISI.=20
% So a simple absolute value of impulse response works well.

fad =3D abs(filter(ch, ones(size(hmod))));
fadedSig =3D fad.*hmod;

BER =3D ones(size(SNR));
for n =3D 1:length(SNR)

    % AWGN
    rxSig =3D awgn(fadedSig,SNR(n),'measured');

    % Constellation Mapping
    % h =3D scatterplot(rxSig,1,0,'b.',h);

    % Demodulation
    rx =3D qamdemod(rxSig,M);
    [nErrors, BER(n)] =3D biterr(tx,rx);
end
semilogy(SNR,BER,'r-*');
xlabel('SNR (dB)');
ylabel('BER');
grid on

</PRE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -