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

📄 wrapinto.m

📁 fading 在无线中的应用
💻 M
字号:
function  wxym = wrapinto(xym, rombvec, type)% DESCRIPTION wxym = wrapinto(xym, rombvec, type)%  Matrix xym with complex elements will be wrapped into %  a romb that is generated by the two complex elements of %  rombvec if type is equal to the string 'romb'.%  In the same way xym will be wrapped into a hexagon if %  type is equal to 'hex'.% INPUT%  xym --      Position that should be wraped into the area%  rombvec --  A vector describing the rhombic area%  type --     'hex' or 'romb'% OUTPUT%  wxym --     New positions in the rhombic area% TRY  %  plot(wrapinto(10*irandn(10000,1),exp(i*pi*[0 1]/3),'hex'),'.')%  axis equal%  plot(wrapinto(10*irandn(10000,1),exp(i*pi*[0 1]/3),'romb'),'.')%  axis equal% by Magnus Almgren 991122% the inverse base of rombvec. rombvec(1)*base=>[1 0] rombvec(2)*base=>[0 1] base = inv([real(rombvec.') imag(rombvec.')]);rwa = [real(xym(:)) imag(xym(:))];  % first column real part and second imaginary% wrap it back into the romb twa = rwa*base;wxyv = mod(twa,1)*rombvec.';%wxyv = (twa - round(twa))*rombvec.';if strcmp(type,'hex') % wrap to shortest distance from origo (possibly a hexagon) rwcomb = mplus((-1:1)*rombvec(1),(-1:1)'*rombvec(2)); wxyv = min(mplus(wxyv,rwcomb(:).'),[],2);endwxym = reshape(wxyv,size(xym));

⌨️ 快捷键说明

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