MAPPING OF MPSK AND QAM FROM BINARY TO GRAY
clc;
clear all;
close all;
N = randint(1,1000); % generating symbols
% mode type
m_type=input('Enter the modulation type[ BPSK,2 QPSK,3 8PSK,4 16QAM]: ');
factor=[1;1;1;1];
b=[1;2;3;4]; % number of bits per subcarrier, 1:BPSK,2:QPSK,4:16QAM
input_sequence = N;
k=factor(m_type);
m=b(m_type);
% Selecting constellation as per modulation
switch m
case 1
b=k*[1 -1];
case 2
b=k*[1+1i -1+1i 1-1i -1-1i];
case 3
b=k*[(cos(0)+1i*sin(0)) (cos(pi/4)+1i*sin(pi/4)) (cos(pi/2)+1i*sin(pi/2)) (cos(3*pi/4)+1i*sin(3*pi/4)) (cos(pi)+1i*sin(pi)) (cos(5*pi/4)+1i*sin(5*pi/4)) (cos(6*pi/4)+1i*sin(6*pi/4)) (cos(7*pi/4)+1i*sin(7*pi/4))];
case 4
b=k*[1+1i 1+3i 1-1i 1-3i 3+1i 3+3i 3-1i 3-3i -1+1i -1+3i -1-1i -1-3i -3+1i -3+3i -3-1i -3-3i];
end
c1=1;
c2=1;
for i=1:(ceil(length(input_sequence)/m))
temp=0;
for j=1:m
temp=bitor(temp,bitshift(input_sequence(c1),(j-1)));
c1=c1+1;
if(c1>length(input_sequence))
break;
end
end
map_out(c2)=b(temp+1);
c2=c2+1;
end
% plot
figure;
plot(real(map_out),imag(map_out),'k.');
axis ([-5 5 -5 5]);
title('CONSTELLATION');
引用格式
raghav khandelwal (2024). MAPPING OF MPSK AND QAM FROM BINARY TO GRAY (https://www.mathworks.com/matlabcentral/fileexchange/50851-mapping-of-mpsk-and-qam-from-binary-to-gray), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
- Wireless Communications > Communications Toolbox > PHY Components > Modulation > QAM >
- Wireless Communications > Communications Toolbox > PHY Components > Modulation > MPSK >
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |