cp0203_qpsk_demod.m
来自「uwb无线电基础书本(电子工业出版社)的MATLAB程序」· M 代码 · 共 40 行
M
40 行
%
% 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(i))>0 & angle(S(i))<pi/2)
r_bits(2*(i-1)+1) = 1;
r_bits(2*(i-1)+2) = 1;
end
if (angle(S(i))>pi/2 & angle(S(i))<pi)
r_bits(2*(i-1)+1) = 0;
r_bits(2*(i-1)+2) = 0;
end
if (angle(S(i))>-pi/2 & angle(S(i))<0)
r_bits(2*(i-1)+1) = 1;
r_bits(2*(i-1)+2) = 0;
end
if (angle(S(i))>-pi & angle(S(i))<-pi/2)
r_bits(2*(i-1)+1) = 0;
r_bits(2*(i-1)+2) = 1;
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?