首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >QPSK星座图

QPSK星座图
EN

Stack Overflow用户
提问于 2015-03-03 12:24:42
回答 1查看 15.9K关注 0票数 1

下面是我的QPSK通信的MATLAB代码:

代码语言:javascript
复制
clc;
clear all;
close all;
data=[0  1 0 1 1 1 0 0 1 1]; % information
%Number_of_bit=1024;
%data=randint(Number_of_bit,1);
figure(1)
stem(data, 'linewidth',3), grid on;
title('  Information before Transmiting ');
axis([ 0 11 0 1.5]);
data_NZR=2*data-1; % Data Represented at NZR form for QPSK modulation
s_p_data=reshape(data_NZR,2,length(data)/2);  % S/P convertion of data
br=10.^6; %Let us transmission bit rate  1000000
f=br; % minimum carrier frequency
T=1/br; % bit duration
t=T/99:T/99:T; % Time vector for one bit information
% XXXXXXXXXXXXXXXXXXXXXXX QPSK modulation  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
y=[];
y_in=[];
y_qd=[];
for(i=1:length(data)/2)
    y1=s_p_data(1,i)*cos(2*pi*f*t); % inphase component
    y2=s_p_data(2,i)*sin(2*pi*f*t) ;% Quadrature component
    y_in=[y_in y1]; % inphase signal vector
    y_qd=[y_qd y2]; %quadrature signal vector
    y=[y y1+y2]; % modulated signal vector
end
Tx_sig=y; % transmitting signal after modulation
tt=T/99:T/99:(T*length(data))/2;
figure(2)
subplot(3,1,1);
plot(tt,y_in,'linewidth',3), grid on;
title(' wave form for inphase component in QPSK modulation ');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
subplot(3,1,2);
plot(tt,y_qd,'linewidth',3), grid on;
title(' wave form for Quadrature component in QPSK modulation ');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
subplot(3,1,3);
plot(tt,Tx_sig,'r','linewidth',3), grid on;
title('QPSK modulated signal (sum of inphase and Quadrature phase signal)');
xlabel('time(sec)');
ylabel(' amplitude(volt0');

我无法理解要使用哪些值来生成代码的相位星座图?在我的代码中有什么方法可以生成正确的相位星座图?

==============更新==============

代码语言:javascript
复制
clc;
clear all;
close all;
data=[0 0 1 1 0 1 1 0 1 1 1 0]; % information
figure(1)
stem(data, 'linewidth',3), grid on;
title('  Information before Transmiting ');
axis([ 0 11 0 1.5]);
data_NZR=2*data-1; % Data Represented at NZR form for QPSK modulation
s_p_data=reshape(data_NZR,2,length(data)/2);  % S/P convertion of data
br=10.^6; %Let us transmission bit rate  1000000
f=br; % minimum carrier frequency
T=1/br; % bit duration
t=T/99:T/99:T; % Time vector for one bit information
y=[];
y_in=[];
y_qd=[];
d=zeros(1,length(data)/2);
for i=1:length(data)/2
    p=data(2*i);
    imp=data(2*i - 1);
    y1=s_p_data(1,i)*cos(2*pi*f*t); % inphase component
    y2=s_p_data(2,i)*sin(2*pi*f*t) ;% Quadrature component
    y_in=[y_in y1]; % inphase signal vector
    y_qd=[y_qd y2]; %quadrature signal vector
    y=[y y1+y2]; % modulated signal vector
    if (imp == 0) && (p == 0)
       d(i)=exp(j*pi/4);%45 degrees
    end
    if (imp == 1)&&(p == 0)
        d(i)=exp(j*3*pi/4);%135 degrees
    end
    if (imp == 1)&&(p == 1)
        d(i)=exp(j*5*pi/4);%225 degrees
    end
    if (imp == 0)&&(p == 1)
        d(i)=exp(j*7*pi/4);%315 degrees
    end
end
Tx_sig=y; % transmitting signal after modulation
qpsk=d;
tt=T/99:T/99:(T*length(data))/2;
figure(2)
subplot(3,1,1);
plot(tt,y_in,'linewidth',3), grid on;
title(' wave form for inphase component in QPSK modulation ');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
subplot(3,1,2);
plot(tt,y_qd,'linewidth',3), grid on;
title(' wave form for Quadrature component in QPSK modulation ');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
subplot(3,1,3);
plot(tt,Tx_sig,'r','linewidth',3), grid on;
title('QPSK modulated signal (sum of inphase and Quadrature phase signal)');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
figure(3);
plot(d,'o');%plot constellation without noise
axis([-2 2 -2 2]);
grid on;
xlabel('real'); ylabel('imag');
title('QPSK constellation');
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-04 16:03:11

QPSK符号字母表有四个复杂的符号。通过在1..4中生成随机整数数组并将这些数字映射到复杂符号,可以创建一组随机的QPSK符号:

代码语言:javascript
复制
num_symbols = 1e4;
int_symbols = randi([1, 4], 1, num_symbols);
A = sqrt(2);
qpsk_symbols = zeros(size(int_symbols));
qpsk_symbols(int_symbols == 1) =   A + 1i*A;
qpsk_symbols(int_symbols == 2) =   A - 1i*A;
qpsk_symbols(int_symbols == 3) = - A + 1i*A;
qpsk_symbols(int_symbols == 4) = - A - 1i*A;
tx_sig = qpsk_symbols;

tx_sig可以是通信系统中的传输信号。若要绘制星座图,请使用实部分作为x值,将虚设部分用作绘图命令中的y值。此外,使用'.'作为线条,这样每个值都只是用一个点来表示,而没有线连接:

代码语言:javascript
复制
fh1 = figure;
plot_lims = [-3 3];
plot(real(qpsk_symbols), imag(qpsk_symbols), '.');
xlim(plot_lims);
ylim(plot_lims);
title('QPSK constellation without noise');
xlabel('real part');
ylabel('imaginary part');

这会产生

这表明了四个不同的观点。添加噪音使得这更有趣:

代码语言:javascript
复制
snr = 15; %// in dB
rx_sig = awgn(tx_sig, snr, 'measured');

fh2 = figure;
plot(real(rx_sig), imag(rx_sig), '.');
xlim(plot_lims);
ylim(plot_lims);
title(['QPSK constellation at an SNR of ' num2str(snr) ' dB']);
xlabel('real part');
ylabel('imaginary part');

这可能是通信系统中的接收信号,而忽略了符号间干扰和其他频率选择组件。(加性高斯白噪声的所谓AWGN信道)。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28831781

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档