📄 synchronization.m
字号:
function [corr_max,sample_nr]=synchronization(in_data_block, fs, T, training_sequence, model)% [corr_max,sample_nr]=synchronization(in_data_block, fs, T, training_sequence, model)%% % Output:
% sample_nr - Sample number, counted from first value in inphase_data_block% where sampling is best performed.% corr_max - Max value of the correlation %% Input:% in_data_block - Output from MF% fs - Sampling rate% T - Symboltime% training_sequence - Training_sequence, same as concatenated in transmitter.% model - Specifies if Alamouti-coding has been used.
% model = 0 : No Alamouti-coding in transm.
% model = 1 : Alamouti-coding in transm.
% % Short Theoretical Background for the Function:%% Slides the training-sequence over the recieved matched-filtered% inphase- or quadrature component and returns the number of the sample where the% first value of the train.-seq. has it's start.%% The implentation can be compared to theory described in QPSK-lab% performed in the course of communication theory, year 2001 KTH.%
% Assuming first part of data is training-sequence through antenna 1.
% (and performing sync. only on these data, not 2:nd antennas train.)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Function part of simulation for Space-Time%%% coding project, group Grey-2001.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Author: Stefan Uppg錼d% Date: 2001-03-20 and 21% Version: 1.0% Revision (Name & Date % Spec): % 1.1 SU 2001-03-24 Adding the Alamouti-functioncall.% 1.2 SU 2001-03-25 Decreased the slidingdistance to one train.seq.length.% 1.3 SU 2001-03-27 Added the absolute function after for-loop.% 1.4 SU 2001-03-28 Increased the slidingdistance to three train.seq.length% 1.5 FH 2001-03-30 returns the maxvalue of the correlation % 1.6 SU 2001-04-04 Removed the Alamouti-coding.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Correlates the inphase-part with %%%r = in_data_block; % Rename variable to make the code easier to read.
c1 = bpsk(training_sequence,model);L = length(c1); % Length of BPSK:ed training-sequence.Q = fs*T; % Number of samples per symbol.sum_of_r_times_c1 = [];for(m=1:1*Q*L) % Lets m = sample_time slides one time the train.seq.distance. sum_of_r_times_c1 = [sum_of_r_times_c1 (r(m : Q: L*Q+m-1) * c1')];endsum_of_r_times_c1 = abs(sum_of_r_times_c1);figure(10), plot(sum_of_r_times_c1)[corr_max, sample_nr] = max(sum_of_r_times_c1); % Skips the abs(...) noted in QPSK-lab.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -