1. 程式人生 > 其它 >QPSK訊號調製之ASCII碼

QPSK訊號調製之ASCII碼

技術標籤:程式設計小識QPSK調製ASCII成型濾波

clear;close all;clc;
sym_dec=(32:126).';
sym_bit=de2bi(sym_dec,8,'left-msb');
sym_bit=reshape(sym_bit.',1,[]);
bits = repmat(sym_bit,1,50).';
% bit2 = reshape(bits,2,[]).';
N=length(bits)/2;

M=4;
pha_qpsk = qammod(bits,M,'InputType','bit','PlotConstellation',true); % 生成相位
Fs = 65536; % 取樣率
fc = 25120; % 載頻
RB = 4096;
fd=Fs/RB;
alpha = 0.25;
h = rcosdesign(alpha,6,Fs/RB,'sqrt'); % 根升餘弦成形
len_x = length(pha_qpsk);
xx = zeros(1,(len_x)*fd);
for i = 1:len_x
    xx((i-1)*fd+1)=pha_qpsk(i);
end
bas_qpsk = conv(xx,h,'same'); % 成形濾波
Len = N*Fs/RB;
t = 0:1/Fs:(Len-1)/Fs;
sig_qpsk_pure = bas_qpsk.*exp(1j*2*pi*(fc)*t); % 混頻
sig_qpsk = 0.7*sig_qpsk_pure./max(abs(sig_qpsk_pure));
fid = fopen('QPSK_regu_32-126.mod','wb');
fwrite(fid,real(sig_qpsk),'single');
fclose(fid);