资源简介
cwtrack1.zip
代码片段和文件信息
clear all;
clc;
fs=48.96e6*2;
fc=12.24e6+1e3;%e2;
ovfs=8;
ks=255;
data_len=20;
rp_len=300;
ds_len=data_len*255;
SNR=10;
carrie_len=data_len*255*3*ovfs;
%rx parameter
NCO_ADDR=0:1023;
NCO_LUT_S=round(127.*(sin((2*pi*1/1023).*NCO_ADDR)));
NCO_LUT_C=round(127.*(cos((2*pi*1/1023).*NCO_ADDR)));
cwfcw=2^32/ovfs;%carrie frequency control word
dtclk=0;
acc_tmpi=0;
acc_tmpq=0;
accum_i=0;
accum_q=0;
ik1=1;
ik2=1;
qk1=1;
qk2=1;
lp_accum1=0;
lp_accum2=0;
fk1=0;
fk2=0;
pk1=0;
pk2=0;
pk3=0;
lp_out=0;
fcw=0;
flag=0;
cw_fcw=cwfcw;
cnt=0;
h=0;
cnt_12=0;
pn_index=1;
data_a=((randi(21data_len)-1).*2)-1;%random bin data
pn_code=(kasami_code([1 1 1 0][1 0 1 0 0 1 0 1][1 0 0 1][0 1 1 1 0 0 0 1])).*2-1;
for rp=1:rp_len
for k=1:carrie_len
carrie_data(k)=fix(3.*cos(2*pi*fc*((rp-1)*carrie_len+k)/fs));
end
data_out_noise=awgn(sqrt(2).*carrie_dataSNR0);
gate_v1=0;
sum_v1=0;
v1_cnt=0;
gate_v2=0;
sum_v2=0;
v2_cnt=0;
for j=1:length(data_out_noise)
if data_out_noise(j)>=0
v1_cnt=v1_cnt+1;
sum_v1=sum_v1+data_out_noise(j);
else
v2_cnt=v2_cnt+1;
sum_v2=sum_v2+data_out_noise(j);
end
end
gate_v1=sum_v1/v1_cnt;
gate_v2=sum_v2/v2_cnt;
noise_out=zeros(1length(data_out_noise));
for s=1:length(data_out_noise)
if data_out_noise(s)>=0
if data_out_noise(s)>gate_v1
noise_out(s)=3;
else
noise_out(s)=1;
end
else
if data_out_noise(s)>gate_v2
noise_out(s)=-1;
else
noise_out(s)=-3;
end
end
end
%pn code dss
ds_data=zeros(1carrie_len);
for z=1:data_len
for o=1:255
for p=1:3*ovfs
ds_data((z-1)*255*3*ovfs+(o-1)*3*ovfs+p)=pn_code(o)*data_a(z);
end
end
end
%modulation
tx_out=ds_data.*noise_out;
for k=1:carrie_len
nco_fcw=bitshift(bitand(((2^32-1)-(2^22-1))(cw_fcw))-22);%get high 10 bit of cwfcw
if nco_fcw ==0
nco_fcw=1;
end
nco_s_out=NCO_LUT_S(nco_fcw);
nco_c_out=NCO_LUT_C(nco_fcw);
%iq mixer
i_data=tx_out(k)*nco_c_out;
q_data=tx_out(k)*nco_s_out;
%pn code
if cnt_12 == 3*ovfs && pn_index ==255
pn_index=1;
elseif cnt_12 == 3*ovfs
pn_index=pn_index+1;
end
pn=pn_code(pn_index);
if cnt_12 == 3*ovfs
cnt_12=1;
else
cnt_12=cnt_12+1;
end
%accm
if dtclk==1
acc_tmpi=accum_i+i_data*pn;
acc_tmpq=accum_q+q_data*pn;
accum_i=0;
accum_q=0;
else
accum_i=accum_i+i_data*pn;
accum_q=accum_q+q_data*pn;
end
%for test
% pn_tmp(k)=pn;
% iaccm_tmp(k)=accum_i;
% qaccm_tmp(k)=accum_q;
%cwtrack
if dtclk ==1
ik2=ik1;
ik1=acc_tmpi;
qk2=qk1;
qk1=acc_tmpq;
% if (qk1<0 && ik1 <0) ||(qk1 >0 && ik1 <0)
% qk1=-qk1;
% ik1=-ik1;
% end
if ik1==0
phi=fix(atan(qk1/1)*2^32);
else
phi=fix(atan(qk1/ik1)*2^32);
end
if ((ik1*qk2-ik2*qk1)<0 && (ik1*ik2+qk1*qk2) <0) || ((ik1*qk2-ik2*qk1)>0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 671 2014-01-05 15:20 kasami_code.m
文件 1105 2014-01-05 17:13 test_pn.m
文件 4285 2014-04-23 12:25 cwtrack.m
相关资源
- sscom51.rar
- 基于51单片机的温度控制系统.rar
- ATS52_VER4.DSN
- KeygenMDK522.zip
- 自动贩卖机.rar
- 求职信i-worm.klez.zip
- url.txt
- 10kV_Cable_insulation.pscx
- LA1016软件+驱动的使用说明.pdf
- 信息论基础习题和答案.pdf
- 6个88点阵拼接显示.pdsprj
- 2be2dce3a3160d83840556642f7c2dfc.rar
- VS2013+OpenCV 2.4.9项目生成EXE文件如何在
- sslclient-win-1.1.3.173.pkg
- 14.机器学习对抗生成网络.txt
- Ansys.EM2019R2地址.rar
- 清华大学-邓俊辉MOOC数据结构与算法课
- 教学管理系统.rar
- 仿真图.zip
- InductionMotorDirectTorque.rar
- MMA14.zip
- Quartus_18.1链接和破解器.rar
- 微博自动评论助手.crx
- Axure高保真原型:移动客户端的设计与
- 200套PPT模版_带有索引.txt
- 飞狐加速器E版.rar
- CNNIC数字证书工具1.2和rootsupd.exe.zip
- rar(9)
- 课程设计.doc
- 20161031133804181.rar
评论
共有 条评论