使用Matlab绘制星座图

From:http://blog.163.com/yuan1096018567@126/blog/static/133621174201481272048362/
散点图(scatter plot)常常用来可视化与数字调制相关的信号星座(constellation);

           为了绘制与调制过程相关的信号星座,需要有如下步骤:

            1、创建信号[0:M-1],此信号表示调制器的所有可能输入;

            2、使用适当的调制函数来调制信号。如果需要,控制输出的幅度(scale)。结果是信号星座图所有点的集合;

            3、对调制结果应用scatterplot函数来得到图;

例子:

Create 16-PSK Constellation Scatter Plot(构建16PSK的星座散点图)

代码如下:
 
   

% Use 16-PSK modulation.
hMod = modem.pskmod(16);

% Create a scatter plot
scatterPlot = commscope.ScatterPlot('SamplesPerSymbol',1,'Constellation',hMod.Constellation);
% Show constellation
scatterPlot.PlotSettings.Constellation = 'on';
scatterPlot.PlotSettings.ConstellationStyle = 'rd';
% Add symbol labels
hold on;
k=log2(hMod.M);
for jj=1:hMod.M
        text(real(hMod.Constellation(jj))-0.15,...,
        imag(hMod.Constellation(jj))+0.15,...
        dec2base(hMod.SymbolMapping(jj),2,k));
end
hold off;

结果如下图:

 例子2:绘制32QAM的星座散点图
 
   

% Create 32-QAM modulator
hMod = modem.qammod(32);
% Create a scatter plot
scatterPlot = commscope.ScatterPlot('SamplesPerSymbol',1,'Constellation',hMod.Constellation);
% Show constellation
scatterPlot.PlotSettings.Constellation = 'on';
scatterPlot.PlotSettings.ConstellationStyle = 'rd';
% Add symbol labels
hold on;
for jj=1:hMod.M
   text(real(hMod.Constellation(jj)),imag(hMod.Constellation(jj)),...
   [' ' num2str(hMod.SymbolMapping(jj))]);
end
hold off;

结果如下图所示:
 

你可能感兴趣的:(MATLAB和SIMULINK)