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

📄 orthosynchronization.m

📁 这个程序主要是实现空时编码的matlab编解码仿真。
💻 M
字号:
function [corr_max,sample_nr,sum_of_r_times_c1,sum_of_r_times_d2]=orthosynchronization(in_data_block, fs, T, train1, train2, model)% 	[corr_max,sample_nr,sum_of_r_times_c1,sum_of_r_times_d2]=orthosynchronization(in_data_block, fs, T, train1, train2, 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 	%   sum_of_r_times_c1       - Correlation vector for train1%   sum_of_r_times_d2       - Correlation vector for train2%%   Input:%	in_data_block 	        - Output from MF%   fs                 	    - Sampling rate%   T                  	    - Symboltime%   train1           	    - Training_sequence1, same as concatenated in transmitter.%   train2                  - Training_sequence2 (BOTH BINARY!)%	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 second%    part is training-sequence through antenna2. If model = 0 only training-sequence one is used.
%	
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     %%% 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 %   2.0 FH  2001-04-02  correlate with trainingsequence two as well                  %	 3.0 SU	2001-04-08	Perform synch. on two orthogonal train.sequences.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Correlates the inphase-part with %%%r = in_data_block;         % Rename variable to make the code easier to read.c1 = bpsk(train1,model);d2 = bpsk(train2,model);
L1 = length(c1);                  % Length of BPSK:ed training-sequence.L2 = length(d2);Q = fs*T;                      	% Number of samples per symbol.%% correlation for trainingsequence one%sum_of_r_times_c1 = [];for(m=1:1*Q*L1)     % Lets m = sample_time slides one time the train.seq.distance.    sum_of_r_times_c1 = [sum_of_r_times_c1 (r(m : Q: L1*Q+m-1) * c1')];endsum_of_r_times_c1 = abs(sum_of_r_times_c1);figure(10), stem(sum_of_r_times_c1)[corr_max1, sample_nr1] = max(sum_of_r_times_c1);%% correlation for trainingsequence two%
if model==1    sum_of_r_times_d2 = [];    for(m=1:1*Q*L2)     % Lets m = sample_time slides one times the train.seq.distance.        sum_of_r_times_d2 = [sum_of_r_times_d2 (r(m : Q: L2*Q+m-1) * d2')];    end    sum_of_r_times_d2 = abs(sum_of_r_times_d2);    %figure(11), plot(sum_of_r_times_d2)    [corr_max2, sample_nr2] = max(sum_of_r_times_d2);     % choose the one with the biggest maximum    if corr_max1 > corr_max2        corr_max = corr_max1;        sample_nr = sample_nr1;    else        corr_max = corr_max2;        sample_nr = sample_nr2;     end % corr_max1>corr_max2
else %model!=1    corr_max = corr_max1;    sample_nr = sample_nr1;    sum_of_r_times_d2 = 0;end %model==1

⌨️ 快捷键说明

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