• 大小: 5KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-06
  • 语言: Matlab
  • 标签: MATLAB  

资源简介

gardner位定时同步MATLAB仿真代码,需要理解学习的下载看看

资源截图

代码片段和文件信息

%File:timing_syn.m timing synchronization
clc
clear
Data_Len = 2000;

Fs = 3840000*8;                  % Sampling Frequency
Fd = 3840000;                  % Symbol Frequency 四倍采样速率
SNR = 30;                   % S/N Ratio for Chanel Simulatioin 
RolloffCoef = 0.22;         % Roll Off Coeff.
T_Gain = 0.02;              % TED Loop Gain

Ratio = Fs/Fd/2;            % = Ts/Td/2 每个符号输出两个采样点
Offset = 32;                % 

timing_error = 0;
datalen = Fs / Fd * (Data_Len - Offset);
displaysize  = 1280;
ted_out = zeros(1displaysize);
Interp_Pos = 2*Ratio + Ratio;
Rec_out = zeros(1displaysize);

disp(‘1 Data Send‘);
%1+++++++++++++Data Source+++++++++++++++++++
disp(‘  1.1 Data Source‘);
x = (-1).^(rand(1Data_Len)>0.5) + j * (-1).^(rand(1Data_Len)>0.5);

figure(1)
plot(x‘r*‘);
xlabel(‘real‘)
ylabel(‘image‘)
xlim([-2.0 2.0]);
ylim([-2.0 2.0]);
title(‘Sending Conset‘)
grid on;

%+++++++++++++pulse shaping+++++++++++++++++++
%        Using Rolloff Setting
%+++++++++++++++++++++++++++++++++++++++++++++
disp(‘  1.2 Pulse Shaping‘);
x_t=rcosflt(xFdFs‘sqrt‘RolloffCoef);

%+++++++++++++channel simulation++++++++++++++
%   Add White Offsetoise Using SOffsetR Setting        
%+++++++++++++++++++++++++++++++++++++++++++++
disp(‘2 Channel Simulation‘);
c_t = awgn(x_tSNR‘measured‘);

%++++++++++++++++++receive++++++++++++++++++++
disp(‘3 Receive‘);

%4++++++++++Matching Filter++++++++++++++++++++
disp(‘  3.1 Matching Filter‘);
%matched_data=rcosflt(r_tFdFs‘sqrt/Fs‘RolloffCoef);
r_t=rcosflt(c_tFdFs‘sqrt/Fs‘RolloffCoef);
matched_data=[r_t(Offset+1:end-Offset)];

%++++++++++++Timing Recovery+++++++++++++++++++
% =======Gardner Timing Recovery=============== 
%  TE(k)={Y[(k-1)Td]-Y[kTd])*Y[(kTd-Td/2]
% =======Parabolic Interpolation=============== 
%     C_2 =  0.5 * mu^2 - 0.5 * mu;
%     C_1 = -0.5 * mu^2 + ( 0.5 + 1 ) * mu;
%     C0  = -0.5 * mu^2 + ( 0.5 - 1 ) * mu + 1;
%     C1  =  0.5 * mu^2 - 0.5 * mu;
%+++++++++++++++++++++++++++++++++++++++++++++++
disp(‘  3.2 Timing Recovery‘);
C_2 = inline(‘0.5*u^2-0.5*u‘);
C_1 = inline(‘-0.5*u^2+1.5*u‘);
C0  = inline(‘-0.5*u^2-0.5*u+1‘);
C1  = inline(‘0.5*u^2-0.5*u‘);

ted_data1 = matched_data(Offset);
ted_data2 = matched_data(Offset+Ratio);

% hp = timing_prefilter(TTi2beta);
k = 1;
m=1;
count = 0;

while(  Interp_Pos < ( datalen - 6 ) )
    %++++++++++++The first half++++++++++++++++++
    mk = floor(Interp_Pos);         % Integer Part
    uk = Interp_Pos-mk;             % Fraction Part
    u(m)=uk;
  

评论

共有 条评论