?? space.m
字號:
function data_enc = space(data,lt_data,lt_state,varargin)%SPACE Space-time channel encoder.% DATA_ENC = SPACE(DATA,LT_DATA,LT_STATE) performs DATA encoding% based on LT_DATA and LT_STATE look-up tables. For instance of% AT&T space-time codes these tables may be easily obtained from% LTABLE function. In fact the structure of look-up tables is% as general as possible. By the way the encoder doesn't care about % content of look-up tables. This feature allow to force the % encoder operation mode into arbitrary scheme. Even an encoding based% on block codes may be performed via SPACE function. This is when the% LT_STATE table contains same entries. There is also a zero-force% check performed during each frame encoding process. %% DATA_ENC = SPACE(DATA,LT_DATA,LT_STATE,'FullReport') returns a full% encoding report in form of table. This feature is available only% when internal function echo is enabled.%% DATA_ENC = SPACE(...,'EchoOn') toggles internal function echo on.%% See also LTABLE, DISPDES.% Copyright 2001-2002 Kamil Anis, anisk@feld.cvut.cz% Dept. of Radioelectronics, % Faculty of Electrical Engineering% Czech Technical University in Pragu% $Revision: 2.0 $ $Date: 2002/10/23 17:33:28 $% --% <additional stuff should go here>[fr_length,l,frames] = size(data);[foo1,md,foo2] = size(lt_data);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BODY BEGIN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%s = 1; % setting up initial statefor k = 1:frames for i = 1:fr_length % stc encoder d = data(i,1,k) + 1; % data_dim=1 % stc encoder data_enc(i,:,k)=lt_data(s,d,:); % stc encoder s=lt_state(s,d,:); % stc encoder end % stc encoder % zero force flag if (i == fr_length) & (s ~= 1) zf_check(k,1) = 0; else zf_check(k,1) = 1; endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BODY END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if isempty(varargin) == 0 switch varargin{1} case 'EchoOn' [indent,gap,name] = iprompt('SPACE:'); disp(' '); if zf_check == 1 disp([name,gap,'All frames were encoded successfuly.']); else disp([name,gap,'Some frames were encoded uncorrectly!']); disp([indent,'Use |FullReport| option to get more details.']); end if (length(varargin) ==2 ) & (varargin{2} == 'FullReport') [m,n] = size(zf_check); table(:,1) = [1:m]'; table(:,2) = zf_check; disp(' '); disp([indent,' Frame | Status']); disp([indent,'-------+-------']); str1 = sprintf([indent,' #%3d | %3d\n'],table'); disp(str1); disp([indent,'Legend: "1" = OK; "0" = wrong encoded.']); end disp(' '); endend
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -