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

📄 example8.m

📁 或许这个代码会对大家有用
💻 M
字号:
%MATLAB program 5-8
%8-QASK
%clear all;
%clc;
% Number of symbols in alphabet
M = 8;
% Number of symbols in the original message
len = 10000; 
% Assume the original message is sampled
Fd = 1; 
% at a rate of 1 sample per second.
Fs = 3; % The modulated signal will be sampled
% at a rate of 3 samples per second.
% Create a signal.
signal = randint(len,1,M); % Random digital message
% consisting of integers between 0 and M-1
% Use M-ary QASK modulation with two different labeled
% square constellations.
modsignal(:,1) = dmodce(signal,Fd,Fs,'qask',M);
inphase = [-3:2:3, -3:2:3];
quad = [ones(1,4), -1*ones(1,4)];
modsignal(:,2) = dmodce(signal,Fd,Fs,'qask/arb',inphase,quad);
% Add noise to real and imaginary parts of the modulated signal.
noisy = modsignal+.5*randn(len*Fs/Fd,2)...
   +j*.5*randn(len*Fs/Fd,2);
% Demodulate to recover the message.
newsignal(:,1) = ddemodce(noisy(:,1),Fd,Fs,'qask',M);
newsignal(:,2) = ddemodce(noisy(:,2),Fd,Fs,...
   'qask/arb',inphase,quad);
% Check whether Gray code resulted in fewer bit errors.
% Compare signal with each column of newsignal.
[num,rate] = biterr(newsignal,signal); 
disp('Bit error rates for the two constellations used here')
disp('--------------------------------------------------------')
disp(['Gray code constellation:     ', num2str(rate(1))])
disp(['Non-Gray code constellation: ', num2str(rate(2))])
% Plot signal constellations with Gray code labeling.
modmap('qask',M);

⌨️ 快捷键说明

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