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

📄 k2sub.m

📁 JLAB is a set of Matlab functions I have written or co-written over the past fifteen years for the p
💻 M
字号:
function[m,n,index]=k2sub(K,dk,N)%K2SUB Convert a complex-valued wavenumber into an I,J subscript pair%  %   [I,J,INDEX]=K2SUB(K,DK,N), K is a complex-valued wavenumber which%   occurs on an NxN wavenumber grid with wavenumber spacing DK,%   returns the I,J indices corresponding to the location of K on the%   grid.  %  %   Only I,J values >0 and <N+1 are returned, and these correspond to   %   locations INDEX in K(:).  %  %   K2SUB is inverted by SUB2K.  See also WAVEGRID.%   _________________________________________________________________%   This is part of JLAB --- type 'help jlab' for more information%   (C) 2003, 2004 J.M. Lilly --- type 'help jlab_license' for details        if strcmp(K, '--t')  k2sub_test,returnendn=real(K)./dk+(N+1)/2;m=imag(K)./dk+(N+1)/2;n=round(n);m=round(m);index=find(n>0 & n<N+1 & m>0 & m<N+1);[n,m]=vindex(n(:),m(:),index,1);function[K]=k2sub_testk=sub2k([1:5],0*[1:5]+2+1,1,5);[m,n]=k2sub(k,1,5);bool=aresame(m,[1:5]') && aresame(n,3+0*n);reporttest('K2SUB for 1 x 5 unit spacing wavegrid',bool)k=sub2k([1:4],0*[1:4]+2,1,4);[m,n]=k2sub(k,1,4);bool=aresame(m,[1:4]') && aresame(n,2+0*n);reporttest('K2SUB for 1 x 5 unit spacing wavegrid',bool)dk=1;N=5;[ii,jj]=k2sub(wavegrid(dk,N),dk,N);[ii2,jj2]=ind2sub([5 5],[1:25]);bool=allall(ii(:)==ii2(:)) && allall(jj(:)==jj2(:));reporttest('K2SUB for 5 x 5 unit spacing wavegrid',bool)  

⌨️ 快捷键说明

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