📄 sttrellis.m
字号:
function [x1 x2 bin] = stTrellis(G)
% Create space time trellis structure
% G : generator matrix
%
% x1 : matrix of current states trellis
% x2 : matrix of next states trellis
% bin : matrix of binary bits order: 0,1,2,... 2^col
%
%
% Copyright Bagawan S. Nugroho, 2006
[row col] = size(G);
% M-ary, QPSK
m = 4;
% Initialize the trellis
N = 2^col;
bin = zeros(1, col);
x = zeros(N, 2);
% Generate the trellis
for i = 1:N
% Get the binary vector with type of char and convert into numeric
b = int8(dec2bin(i - 1)) - 48;
% Fill-in into size(1, col) vector
bin(i, col - length(b) + 1:col) = b;
% Get the trellis output
x(i,:) = mod((bin(i,:) * G'), 4);
end
% States trellis
x1 = (reshape((x(:,1))', m, N/m))';
x2 = (reshape((x(:,2))', m, N/m))';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -