⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recieve_onsat.m

📁 cdma 系统级仿真
💻 M
字号:
%**************************************************************************
                         %※ 星上数据接收端 ※%
%**************************************************************************
clc;
clear all;
close all;
load send_data1;
Rb=800000;%码元速率819.2k
k=1;        %一个码元间隔包括1个载波周期/2
k2=8;       %采样率
%正交下变频
%A/D模数变换
[recievdataI,recievdataQ]=QPSK_demodu(upsenddata);
datalength=length(upsenddata);
%FFT分路
%*******解扩不解调************%
%产生42位扩频长码
longPNcode=longcode(datalength/k2);
%DSSoutdataI=mod(walshdata96I+longPNcode,2);
%DSSoutdataQ=mod(walshdata96Q+longPNcode,2);
%产生15位扩频短码
shortPNcode=shortcode(datalength/k2);
%长短码进行摸2加,生成本地扰码
despreadcodeI=mod(longPNcode+shortPNcode(1,:),2);
despreadcodeQ=mod(longPNcode+shortPNcode(2,:),2);
%变为双极性码,0->1,1->-1
despreadcode1I=-2*(despreadcodeI-0.5);
despreadcode1Q=-2*(despreadcodeQ-0.5);
%对本地扰码进行8倍采样
for i=1:datalength/k2
    despreadcode2I(1,1+(i-1)*k2:i*k2)=despreadcode1I(i);%将码元展宽x_size倍
    despreadcode2Q(1,1+(i-1)*k2:i*k2)=despreadcode1Q(i);%将码元展宽x_size倍
end
%解扩
N=14;
Wn=1/8;
B = fir1(N,Wn);
despreadout1I=recievdataI.*despreadcode2I;
despreadout1Q=recievdataQ.*despreadcode2Q;
despreadoutI=filter2(B,despreadout1I);
despreadoutQ=filter2(B,despreadout1Q);
%recievdadaQ=filter2(B,recievdata.*carry_Q);

%8:1下采样,spreadtimes=4;
k3=spreadtimes*k2;
for i=1:datalength/k3
    despreadout2I(1,i)=despreadoutI(k3/2+1+k3*(i-1));%将码元展宽x_size倍
    despreadout2Q(1,i)=despreadoutQ(k3/2+1+k3*(i-1));%将码元展宽x_size倍
end
%% *******************************%
despreadout3I=-(sign(despreadout2I)-1)/2;
despreadout3Q=-(sign(despreadout2Q)-1)/2;
%*************星上交换**********%
%CWTDM复接,去下行调制器
%% *******************************%
figure(1)
subplot(4,1,1)
plot(despreadcode2Q)
%axis([0 k3*8 -1.5 1.5])
axis([0 k3*2 -1 1])
grid on
title('扩频码')
subplot(4,1,2)
plot(recievdataQ)
axis([0 k3*2 -1 1])
title('扩频输入信号')
grid on
subplot(4,1,3)
plot(despreadout1Q)
axis([0 k3*2 -1 1])
title('扩频输出信号')
grid on

subplot(4,1,4)
plot(despreadoutQ)
axis([0 k3*2 -1 1])
title('滤波输出信号')
grid on
%% *******************************%
figure(2)
subplot(2,1,1)
stairs(despreadout3I)
%axis([0 k3*8 -1.5 1.5])
axis([1 k3 -0.5 1.5])
grid on
title('扩频码')
subplot(2,1,2)
stairs(walshdataI)
axis([1 k3 -0.5 1.5])
title('扩频输入信号')
grid on

⌨️ 快捷键说明

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