📄 uselognmap.m
字号:
function logn = uselognmap(pos, lognmap, mapvec)% DESCRIPTION logn = uselognmap(pos, lognmap, mapvec)% Generates correlated lognormal values that are position dependent.% This routine is closely related to crelognmap.m% INPUT% pos -- any matrix with complex positions.% values are folded back into the map when outside% lognmap -- Global variable containing the lognormal map.% mapvec -- two complex vector elements describing the size of the map% OUTPUT% logn -- Value of lognormal fading. Same size as the "pos"% input argument% SEE ALSO % crelognmap% by Magnus Almgren 960508, revised 991101% the same border must be used as when the map was createborder = 1; % extension for cubic interpolationsiz = size(lognmap,1)-2*border; % size of side of map% the inverse base of v (v(1)*base => [1 0] and v(2)*base => [0 1] base = inv([real(mapvec.') imag(mapvec.')]);% the portions of v(1) and v(2) for each position elementrpos = [real(pos(:)) imag(pos(:))];% wrap it back into the interval {0,1}mpos = mod_(rpos*base,1);pos1 = reshape(mpos(:,1), size(pos));pos2 = reshape(mpos(:,2), size(pos));% vectors used by interp2 for table lookup mapi = (-1:siz)/siz;% make the interpolationlogn = interp2(mapi, mapi, lognmap.', pos2, pos1, 'cubic');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -