cp0203_qpsk_demod.asv

来自「uwb无线电基础书本(电子工业出版社)的MATLAB程序」· ASV 代码 · 共 45 行

ASV
45
字号
%
% FUNCTION 2.10 : "cp0203_qpsk_mod"
%
% This function receives a binary stream in input ('bits')
% and returns the corresponding sequence of QPSK symbols
%  ('S'),
% plus the two sequences 'Sc' and 'Ss' containing the real
% and the imaginary part of each symbol
%
% Programmed by Guerino Giancola
%

function [r_bits] = cp0203_qpsk_demod(S)



ns = length(S);         % number of bits
nb = ceil(2*ns);        % number of symbols

r_bits = zeros(1,nb);

for i = 1 : ns
    if (angle(S)>0 & angle(S)<pi/2)
        r_bits[2*(i-1)+1] = 0;
        r_bits[2*(i-1)+2] = 0;
    if (angle(S)>0 & angle(S)<pi/2)
        r_bits[2*(i-1)+1] = 0;
        r_bits[2*(i-1)+2] = 0;
    if (angle(S)>0 & angle(S)<pi/2)
        r_bits[2*(i-1)+1] = 0;
        r_bits[2*(i-1)+2] = 0;        
    if (angle(S)>0 & angle(S)<pi/2)
        r_bits[2*(i-1)+1] = 0;
        r_bits[2*(i-1)+2] = 0;       
    ba = b0(((s-1)*2)+1);
    bb = b0(((s-1)*2)+2);
    k = bb + ba*2;
    p = ((pi/4)*(2*k-1))-pi;
    
    Sc(s) = cos(p);
    Ss(s) = sin(p);
    S(s) = Sc(s) + j*Ss(s);
    
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?