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

📄 ruili.m

📁 Tdscdma系统中的载频估计程序
💻 M
字号:
close all;
clc;
clear;
%=============================================================================================
% settings
global fs
       fs = 5.12e6;                    % 采样频率 Hz
global fc 
       fc =3e3;                       % 残留频差 Hz
global Gt
       Gt = 64;                        % 保护间隔64采样
global fd
       fd = 500;                       % 最大多普勒频偏  Hz
global pn_len
       pn_len =16;                     % 扩频码长度
global burst_len
       burst_len = 3456;               % 一个突发长度3456个采样(352*2+144+16)*4:  
global t
       t  =0:1/fs:(burst_len-1)/fs;    % 设置时间 采样间隔
global pathnum
       pathnum  =1;                   % 设置码道数

code_s_len = 16;                       % 扰码长度
bityu_len  = 22;                       % 支路上一个数据域比特个数
%---------------------------------------------------
% 设置多径信道的平均功率和时延
pow            = [-3,0,-2,-6];         % 多径功率dB
delay_pattern  = [0,5,11,18];          % 多径时延 samples
ts=1/fs;
% sg=1;                                     %%%%%%%%%    噪声能量归一化
snr=20;
 Nb=10;
%  for snr=1:25
%    eb=10^(snr/10)*2;
% amp=sqrt(2*eb/16);
% fai=rand;
 for r=1:Nb
%     nois=sg.*randn(1,N);
% n=0:N-1;
% re=amp*(1+j)*exp(-j*2*pi*(fc*n*ts+fai))+nois;
[burst_data,trans_data] = mainsource(pathnum,snr,pow,delay_pattern);
DM=burst_data(1409:1984);



load('midamble_code.mat','midamble')
for n=1:144
    mida_complex(n)=(i)^n*midamble(n);
end;  
mid=zerohold(mida_complex,4);
re=DM.*conj(mid)


for y=1:575
    D(y)=conj(re(y))*re(y+1);
end
% for y=1:512
%     D3(y)=sum(D(y:(y+63)));
% end
D2=sum(D);
DQ=real(D2);
DI=imag(D2);
offset(r)=abs((tan(DI/DQ))/(2*pi*ts))
end
% offoutput(snr)=sum(offset)/Nb
% fangcha(snr)=sqrt(var(offset))
% end
% % end
% plot(offoutput)
% xlabel('snr input(DB)');
% ylabel('carrier offset(Hz)');
% figure(2)
% x=(1:25);
% bar(x,fangcha)
% xlabel('snr input(DB)');
% ylabel(' variance of estimated value (Hz)');

⌨️ 快捷键说明

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