星座点画图

clear
close all
 
M = 16; % Modulation order (alphabet size or number of points in signal constellation)
k = log2(M); % Number of bits per symbol
n = 30000; % Number of bits to process
sps = 1; % Number of samples per symbol (oversampling factor)
 
rng default;
dataIn = randi([0 1],n,1); % Generate vector of binary data
dataInMatrix = reshape(dataIn,length(dataIn)/k,k);
dataSymbolsIn = bi2de(dataInMatrix);
 
dataMod = qammod(dataSymbolsIn,M); % Gray coding with phase offset of zero
 
EbNo = 10;
snr = EbNo+10*log10(k)-10*log10(sps);
 
receivedSignal = awgn(dataMod,snr,'measured');
receivedSignal=receivedSignal.*exp(1j*pi*0.2);
 
 
colour=linspace(1,10,16);
C=colour(dataSymbolsIn+1);
figure
scatter(real(receivedSignal),imag(receivedSignal),2,C)
title('received symbol')
print(gcf,'-dpng','-r300','received symbol.png')
figure
scatter(real(dataMod),imag(dataMod),180,C,'filled')
title('transmitted symbol')
print(gcf,'-dpng','-r300','transmitted symbol.png')

python

import numpy as np
import matplotlib.pyplot as plt
from math import pi
 
k=2
M=2**k
symLen=2**13
np.random.seed(2)
txSymbols = np.random.randint(0,4,size=symLen)
#plt.scatter(txSymbols.real,txSymbols.imag,c=txSymbols,cmap=plt.cm.Set1)
 
rxSymbols=txSymbols*np.exp(1j*pi*0.15)
plt.scatter(rxSymbols.real,rxSymbols.imag,c=txSymbols,cmap=plt.cm.Set1)

原文链接:https://blog.csdn.net/Stephanie2014/article/details/108781004

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值