📄 st_trellis.m
字号:
function [ST_NextState, ST_Output, Lut_InfBits, ModMap] = ... st_trellis(modulation_type, number_of_states);%------------------------------------------------------------------------------% Generate space-time trellis.% % Format:% -------% [ST_NextState, ST_Output, Lut_InfBits, ModMap] = ...% st_trellis(modulation_type, number_of_states)% % Author: MVe% Date: 22.08.2002%------------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- Initialisation -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%j = sqrt(-1);modulation_type = upper(modulation_type);RootDir = pwd;STTCFile = [RootDir '/dat/Tarokh_STTC.dat'];% Check modulation if ~or(strmatch(modulation_type, '4-PSK'),... strmatch(modulation_type, '8-PSK')) error(sprintf('Unknown modulation type ''%s''', modulation_type));end % if ~or(strmatch(modulation_type,'4-PSK'),...% Check statesif sum(number_of_states==[4,8,16,32])~=1 error(sprintf('Unknown number of states ''%d''',number_of_states));end % if sum(states==[4,8,16,32])~=1% Add pathsPath_list = [RootDir ' ' RootDir '/tls ' ... RootDir '/st-decoder ' RootDir '/st-encoder'];eval(['addpath ' Path_list]);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- Find correct trellis-structure -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Format of 'ST_Output'% row number = current state% column 1 = output when input is 00...00% column 2 = output when input is 00...01% column 3 = output when input is 00...10% etc..%% Format of 'ST_NextState':% row number = previous state% column 1 = next state when input is 00...00% column 2 = next state when input is 00...01% column 3 = next state when input is 00...10 % etc..%% Find correct trellis-structure[ST_NextState, ST_Output] = ... find_sttc(STTCFile, modulation_type, number_of_states);% Modulation mapping (no gray-encoding)switch modulation_type case '4-PSK'% $$$ % Tarokh: "Space-Time Codes for..."% $$$ ModMap = sqrt(2)*exp(j*2*pi*[0:1/4:3/4]).'; % Djordje ModMap = sqrt(2)*exp(j*2*pi*([0:1/4:3/4]-3/8)).'; case '8-PSK' % Tarokh: "Space-Time Codes for..." ModMap = sqrt(2)*exp(j*2*pi*[0:1/8:7/8]).'; end % switch modulation_type%%%%%%%%%%%%%%%%%%%%%%%%%%% -- Look-up tables --%%%%%%%%%%%%%%%%%%%%%%%%%%%k = log2(size(ModMap,1));n = log2(size(ModMap,1));m = ceil(log2(size(ST_NextState,1))/k);inputs = double(dec2bin([0:2^k-1]))-48;% Look-up tables for decoding data sequence ('sttc')% Format:% row = current state% column = previous state%Lut_InfBits = cell(number_of_states);for i1 = 1:2^k for i2 = 1:number_of_states Lut_InfBits{i2,ST_NextState(i2,i1)}=inputs(i1,:); end % for i2 = 1:number_of_statesend % for i1 = 2^k
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -