扩频发送.m

来自「用matlab语言实现QPSK调制信号产生」· M 代码 · 共 68 行

M
68
字号
clc;
clear;
Fs=614400;
Nsam=8;
N=128;
FrameLength=100;
Data_I=randsrc(1,FrameLength,[-1,1]);
Data_Q=randsrc(1,FrameLength,[-1,1]);
PN=[0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0
    1 0 0 1 1 1 1 0 1 1 1 0 0 0 0 1
    1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0
    0 0 1 0 1 0 0 1 0 1 1 1 1 1 0 1
    0 1 0 1 0 0 0 0 1 0 1 1 0 1 1 1                       
    1 0 0 1 1 1 0 0 1 0 1 0 1 1 0 0 
    1 1 0 0 0 0 0 1 1 0 1 1 0 1 0 1 
    1 1 0 1 0 0 0 1 1 0 0 1 0 0 0 1];
Data_sam=[1];
for i=1:length(Data_I)
    temp=[];
    for j=1:N*Nsam
        temp(j)=Data_I(i);
    end;
    Data_sam=[Data_sam temp];
end;
I_sam=Data_sam(2:length(Data_sam));

Data_sam=[1];
for i=1:length(Data_Q)
    temp=[];
    for j=1:N*Nsam
        temp(j)=Data_Q(i);
    end;
    Data_sam=[Data_sam temp];
end;
Q_sam=Data_sam(2:length(Data_sam));

stuff=zeros(1,Nsam-1);
for i=1:N
    M_sam8((i-1)*Nsam+1)=2*PN(i)-1;
    M_sam8=[M_sam8 stuff];
end;
R=1.0;
n_T=[-4 4];
rate=Nsam;
T=1;
b=rcosfir(R,n_T,rate,T,'sqrt');
M_temp=M_sam8;
for i=1:FrameLength-1
    M_temp=[M_temp M_sam8];
end;
I_spread=I_sam.*M_temp;
Q_spread=Q_sam.*M_temp;
IS_filter=filter2(b,I_spread,'same');
QS_filter=filter2(b,Q_spread,'same');

figure;
subplot(3,1,1);
plot(IS_filter(1:300));
title('I路扩频信号');
subplot(3,1,2);
plot(QS_filter(1:300));
title('Q路扩频信号');
subplot(3,1,3);
plot(M_sam8(1:300));
title('扩频序列');

    

⌨️ 快捷键说明

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