hmat.m

来自「JLAB is a set of Matlab functions I have」· M 代码 · 共 52 行

M
52
字号
function[h]=hmat(N,dt)%HMAT Hilbert transform matrix%%  H=HMAT(N) returns a matrix an NxN matrix H such that the matrix%  multiplication Y=H*X for X another NxN matrix returns a matrix Y,%  which is the discrete Hilbert transform of X.%%  H=HMAT(N,DT) specifies the 'time' step, assumed to be one%  otherwise, between the elements of the columns of X.  %   _________________________________________________________________%   This is part of JLAB --- type 'help jlab' for more information%   (C) 2004 J.M. Lilly --- type 'help jlab_license' for details          if nargin==1  dt=1;endf=fmat(N,dt);sgnom=ones(N,1);sgnom(1)=0;index=[1:N];index=find(index-1>N/2);sgnom(index)=-1;d=sqrt(-1)*diag(sgnom);h=f'*d*f;if 0  h=zeros(N,N);if iseven(N)   t=[-(N-2)/2:N/2]';elseif isodd(N)   t=[-(N-1)/2:(N-1)/2]';endindex=[1:length(h(:))]';[ii,jj]=ind2sub(size(h),index);h(index)=frac(dt,pi).*frac(1,t(ii)-t(jj));index=find(~isfinite(h));h(index)=0;end

⌨️ 快捷键说明

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