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

📄 makelatt.m

📁 Lattice coding and decoding
💻 M
字号:
function varargout = makelatt(kind,num,dim,varargin)%MAKELATT Create lattice%   L = MAKELATT(KIND,PTS,DIM) makes desired kind of dim-dimensional%   finite lattice that consists of pts elements. Available designs are%   listed in the table below. All the generated lattices are %   geometrically uniform. The lattice points are chosen from the origin%   to higher shells. Sometimes its usefull to generate lattices from the%   number of one dimensional pattern side i.e. PTS = DIM ^ SIDE.%%   Table of available designs%%      Design  | Dimension |   KIND%   -----------+-----------+----------%        Zn    |    n>=1   |   'Z'%        An    |    n>=1   |   'A'%        Dn    |    n>=3   |   'D'%    Hexagonal |    n=2    |  'Hex'%       fcc    |    n=3    |  'fcc'%%   [...] = MAKELATT(KIND,PTS,DIM,'PropertyName',PropertyValue,...)%%   Makelatt Property List%%   Echo           'on' | {'off'}%%   See also TRACELATT, TRANSLATT, ROTLATT, GRAB, SHOWLATT.%   Copyright 2001-2003 Kamil Anis, anisk@feld.cvut.cz%   Dept. of Radioelectronics, %   Faculty of Electrical Engineering%   Czech Technical University in Prague%   $Revision: 0.1 $  $Date: 2003/1/16 17:33:28 $%   --%   <additional stuff goes here>global ECHOname = 'MAKELATT';[idt,tag] = iecho(name);nopts = length(varargin) / 2;opts = reshape(varargin,[2 nopts])';ord1 = strmatch('Echo',opts(:,1));% Echoif ~isempty(ord1) % first check whether local option exists	value1 = opts{ord1,2};	switch value1	case 'on'		ech = 1;	case 'off'		ech = 0;	otherwise		disp(' ');		disp([tag,'Invalid option for Echo property.']);		disp([idt,'Possible values are ''on''|{''off''}.']);		disp(' ');		ech = 0;	endelse	if ~isempty(ECHO) % than check whether global option exists		switch ECHO		case 'on'			ech = 1;		case 'off'			ech = 0;		otherwise			disp(' ');			disp([tag,'Invalid option for Echo property.']);			disp([idt,'Possible values are ''on''|{''off''}.']);			disp(' ');			ech = 0;		end	else % if there are no settings use the defaults		ech = 0; % default value	endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BODY BEGIN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%k = num ^ (1 / dim) - 1;a = span([0:k],dim);switch kindcase 'Z'	G = eye(dim);	case 'A'	if (dim == 2) & ech		disp(' ');		disp([tag,'A2 lattice is equivalent or similar to the hexagonal lattice.']);		disp([idt,'For 2D computations is better to use ''Hex'' lattice.']);		disp(' ');	end	diag_main = -1 * eye(dim);	diag_lateral = ones(dim - 1,1);	G = diag_main + diag(diag_lateral,1);	G(end,end:end + 1) = [-1 1];  case 'D'	if (dim < 3) & ech		disp(' ');		disp([tag,'Invalid dimension! DIM must be greater or equal to 3.']);		disp([idt,'Returning an empty output.']);		disp(' ');		G = []; a = [];	else		diag_main = -1 * eye(dim);		diag_lateral = ones(dim - 1,1);		G = diag_main + diag(diag_lateral,-1);		G(1,2) = -1;	end	case 'Hex'	if (dim ~= 2) & ech		disp(' ');		disp([tag,'Invalid dimension! DIM must be equal to 2.']);		disp([idt,'Returning an empty output.']);		disp(' ');		G = []; a = [];	else		G = 1/2 * [2 0;-1 sqrt(3)];	end		case 'fcc'	if ech		disp(' ');		disp([tag,'''fcc'' latice is equivalent to the D3 lattice.']);		disp(' ');	end		G = [-1 -1 0;1 -1 0;0 1 -1];case 'diff'   %G = [1 9];		   G = [4 4;3 -5];   %G = [1 9;0 32];% case 'Leech24'% 	% 	G = 		endlatt = a(1:end,:) * G;varargout = {latt,G};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BODY END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

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