clear;clc;
tic;
Rs = 800;
over_samp_rate = 8;
% connections = [1 0 1 1 0 0 0 0 0 0 0 0 1];
% connections = [0 1 0 0 1];
connections = [0 0 1 0 0 0 0 0 0 1];
mline = 1 - 2 * m_sequence(connections);% aa = repmat(mline,[1,5]);% bb= conv(mline(8192:-1:1),mline);
spread_rate = length(mline);
fs = Rs * over_samp_rate * spread_rate;
% fc = 49.152e6;
fc = 1.6384e6;
EbN0 = 5.5;
db = EbN0 - 10*log10(over_samp_rate * spread_rate)+10*log10(2);%-10*log10(1.22);
% data_01 = [0 randint(1,3000)];
data_01 = zeros(1,100);
data = 1 - 2 * data_01;
data_num = length(data);
% data_upsample = reshape(repmat(data,[spread_rate,1]),[1,data_num*spread_rate]);
% base_band = data_upsample .* repmat(mline,data_num);
baseband_data = conv(upsample(data,spread_rate),mline);
baseband_data = baseband_data(1:data_num*spread_rate);
shape = rcosfir(0.22,[-3,3],over_samp_rate,1,'sqrt');
baseband = conv(upsample(baseband_data,over_samp_rate),shape);
baseband = baseband(1+3*over_samp_rate:data_num*spread_rate*over_samp_rate+3*over_samp_rate);
IF_sig = baseband .* cos(2*pi*(1:length(baseband))*fc/fs);
receive_if = IF_sig;
% receive_if = floor(IF_sig./(max(abs(IF_sig))) .* 1638);
% mean_receive_if = mean(receive_if .^ 2);
receive_if = awgn(receive_if,db,'measured');
% receive_if = sqrt(5000/mean_receive_if) * receive_if;
%% 正常接收
receive_demod = receive_if .* exp(-1j*2*pi*(1:length(IF_sig))*(fc+50)/fs);
shape_filter = conv(upsample(mline,over_samp_rate),shape);
shape_filter = shape_filter(length(shape):spread_rate*over_samp_rate);
match_filter = conv(receive_demod,shape_filter(length(shape_filter):-1:1));
match_filter = match_filter(over_samp_rate * spread_rate-over_samp_rate * 3:data_num*spread_rate*over_samp_rate);
downsample_match_filter = downsample(match_filter,over_samp_rate*spread_rate);
recover = [];
recover(1) = 0;
for i = 1 : data_num-1
match_charge = downsample_match_filter(i);
% match_charge_after = match_filter((i+1)*1023+561);
match_charge_after = downsample_match_filter(i+1);
if abs(match_charge + match_charge_after)> abs(match_charge - match_charge_after)
recover(i+1) = recover(i);
else
recover(i+1) = mod((recover(i)+1),2);
end
end
recover;
recover_absolute = abs(recover(2:end)-recover(1:end-1));
error_num = sum(abs(diff(recover)) ~= abs(diff(data_01)));
%
pe = error_num / (data_num-1)
%
% % pe2 = berawgn(EbN0,'dpsk',2)
pe2 = berawgn(EbN0,'dpsk',2)
%% 非线性放大接收
%
% baseband2 = reshape(repmat(baseband_data,[over_samp_rate,1]),[1,data_num*spread_rate*over_samp_rate]);
% IF_sig2 = baseband2 .* cos(2*pi*(1:length(baseband2))*fc/fs);
%
% receive_if1 = floor(IF_sig2./(max(abs(IF_sig2))).*1638);
% % % receive_if2 = log2(abs(receive_if1));
%
% mean_receive_if2 = mean(receive_if1 .^ 2);
%
% receive_if2 = sqrt(5000/mean_receive_if2) * receive_if1;
%
% % receive_if2 = receive_if1;
%
% receive_demod2 = receive_if2 .* exp(1j*2*pi*(1:length(IF_sig))*fc/fs);
%
% % shape_filter = conv(upsample(mline,over_samp_rate),shape);
% % shape_filter = shape_filter(length(shape):spread_rate*over_samp_rate);
% match_filter2 = conv(receive_demod2,shape_filter(length(shape_filter):-1:1));
% match_filter2 = match_filter2(232:data_num*spread_rate*over_samp_rate);
% downsample_match_filter = downsample(match_filter2,over_samp_rate*spread_rate);
%
%
toc;
dsss_match_filter.zip_dsss匹配滤波器_match_filter_匹配滤波器matlab仿真
版权申诉
158 浏览量
2022-07-14
10:14:02
上传
评论
收藏 1KB ZIP 举报
朱moyimi
- 粉丝: 61
- 资源: 1万+
最新资源
- kernel-ml-6.8.8-1.el7.elrepo.x86-64.rpm
- Labview基本框架之状态机
- HM2309B-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- Git安全实践:保护你的代码仓库个人学习笔记.md
- 自动驾驶定位系列教程九:后端优化.pdf
- 三国志5威力加强版-windows
- HM2309A-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- HM2306-VB一款N-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- Git进阶技巧:提升团队协作效率个人学习笔记.md
- 自动驾驶定位系列教程八:建图系统结构优化.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈