【源码】QPSK调制与解调的一般实现方法

本代码的QPSK调制与解调过程没有考虑噪声的影响,是一种比较理想的设计方式。

%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

%XXXX QPSK Modulation and Demodulation without consideration of noise XXXXX

%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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 modulatio 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’);

% XXXXXXXXXXXXXXXXXXXXXXXXXXXX QPSK demodulation XXXXXXXXXXXXXXXXXXXXXXXXXX

Rx_data=[];

Rx_sig=Tx_sig; % Received signal

for(i=1:1:length(data)/2)

%%XXXXXX inphase coherent dector XXXXXXX

Z_in=Rx_sig((i-1)*length(t)+1:i*length(t)).*cos(2*pi*f*t); 

% above line indicat multiplication of received & inphase carred signal



Z_in_intg=(trapz(t,Z_in))*(2/T);% integration using trapizodial rull

if(Z_in_intg>0) % Decession Maker

    Rx_in_data=1;

else

   Rx_in_data=0; 

end



%%XXXXXX Quadrature coherent dector XXXXXX

Z_qd=Rx_sig((i-1)*length(t)+1:i*length(t)).*sin(2*pi*f*t);

%above line indicat multiplication ofreceived & Quadphase carred signal



Z_qd_intg=(trapz(t,Z_qd))*(2/T);%integration using trapizodial rull

    if (Z_qd_intg>0)% Decession Maker

    Rx_qd_data=1;

    else

   Rx_qd_data=0; 

    end

    

    

    Rx_data=[Rx_data  Rx_in_data  Rx_qd_data]; % Received Data vector

end

figure(3)

stem(Rx_data,‘linewidth’,3)

title('Information after Receiveing ');

axis([ 0 11 0 1.5]), grid on;

% XXXXXXXXXXXXXXXXXXXXXXXXX end of program XXXXXXXXXXXXXXXXXXXXXXXXXX

完整源码下载地址:

http://page5.dfpan.com/fs/1lc0j2221e298167321/

更多精彩文章请关注微信号:在这里插入图片描述

  • 1
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值